【问题标题】:Undefined is not a function in rails 3 in_place_editUndefined 不是 rails 3 in_place_edit 中的函数
【发布时间】:2011-09-06 09:42:15
【问题描述】:

我的视图中有一个对象 @temp 并想编辑字段 @temp.name in_place 所以我使用了 ruby​​ 中的 in_place_edit gem。

<td><%= in_place_editor_field :temp, :name, {}, :rows => 1  %></td>

下面的代码就是由那个创建的

new Ajax.InPlaceEditor('temp_name_5_in_place_editor', '/temps/set_temp_name?locale=en&id=5', {callback:function(form) { return Form.serialize(form) + '&authenticity_token=' + encodeURIComponent('OX1qBv+oX0BgdF7uq7UM5rzGacmY/9ZLerE6osA6HnI=') }, rows:1})

在我的浏览器中访问该站点时,我无法单击可编辑字段并在 Ajax 代码行出现以下错误:

Uncaught TypeError: undefined is not a function

有人知道我现在要做什么吗?

【问题讨论】:

    标签: jquery ruby-on-rails ruby ajax edit-in-place


    【解决方案1】:

    很抱歉我自己的问题的早期回答,但使用 firebug 进行调试,我得到了比在 google chrome 中更好的异常消息,并发现我还必须在 rails 中包含 javascript 库效果和控件。

    <%= javascript_include_tag "prototype", "effects", "controls" %>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      • 2011-04-05
      • 2020-10-12
      • 2015-10-29
      • 2015-06-05
      相关资源
      最近更新 更多