Rails 3.1.10 Active_scaffold 3.2.17
我收到了 js 错误消息:
Event thread: DOMContentLoaded
Uncaught exception: TypeError: 'jQuery("form.as_form").live' is not a function
Error thrown at line 25, column 5503 in <anonymous function>() in http://localhost/assets/application.js?body=1:
jQuery("form.as_form").live("ajax:beforeSend",function(e){var t=jQuery(this).closest("form");return....................................
有人可以帮忙吗? 谢谢。
最佳答案
我花了半天时间才找到问题所在。
jQuery("form.as_form").live' 不是一个函数,这是因为我的 gemfile 中有:
gem 'active_scaffold'
它正在安装 3.2.17 版本,其中包含过时的 Jquery 1.9 调用(不同 js 库中的 .live)。相反,必须有随叫随到的服务。但发布的 active_scaffold 版本 3.2.17 包含 .live ((
最后我的解决方案是
gem'active_scaffold',git:“https://github.com/activescaffold/active_scaffold.git”
它包含 3.3.0.rc 并且包含 .on jquery 调用而不是 .live。
关于ruby-on-rails-3 - Rails 3.1 active_scaffold 'jQuery("form.as_form").live' 不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14457641/