Rails 3.1 active_scaffold 'jQuery(“form.as_form”).live' is not a function

孤街浪徒 提交于 2019-12-08 02:58:26

问题


Rails 3.1.10 Active_scaffold 3.2.17

I got the js error message:

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....................................

Could anyaone help? Thanks.


回答1:


I spent half a day to find out what is wrong.

jQuery("form.as_form").live' is not a function it is because of I have in my gemfile:

gem 'active_scaffold'

It's installing a 3.2.17 version that contains obsolete for Jquery 1.9 calls .live in different js libraries). Instead there have to be .on call. But released version 3.2.17 of active_scaffold contains .live ((

At last My solution is

gem 'active_scaffold', git: "https://github.com/activescaffold/active_scaffold.git"

it contains 3.3.0.rc and it contains .on jquery calls instead .live.




回答2:


Master branch on github of active_scaffold has dropped Rails 3.1 support, so the solution for that is to update your Gemfile to fix the jquery-rails gem to to one that uses JQuery 1.8.3:

gem 'jquery-rails', '2.1.4'


来源:https://stackoverflow.com/questions/14457641/rails-3-1-active-scaffold-jqueryform-as-form-live-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!