开发者

Rails 3.1 remote requests submitting twice

开发者 https://www.devze.com 2023-04-12 07:30 出处:网络
I developed a Rails 3.1 application that consists of a 100% Ajax CRUD forms to input users and customers.I created two separate models, controllers, views etc.The views for each model contain jquery f

I developed a Rails 3.1 application that consists of a 100% Ajax CRUD forms to input users and customers. I created two separate models, controllers, views etc. The views for each model contain jquery files for create edit update and destroy. The problem is when I perform any operation that performs a remote operation, it is called twice. I can confirm this happening in console view in fireb开发者_运维技巧ug as well as output in WEBrick output. Can anyone assist in tracking down what happened here? What would cause rails to process each call twice?


Adding config.serve_static_assets = false to development.rb will prevent loading files from /public/assets.

Actually I need to precompile locally because my test mode is using only static assets from /public/assets - tests are catching possible production asset problems. How? Just set config.assets.compile = false and config.serve_static_assets = true in test.rb configuration.


If you have precompiled the assets and running in development mode, then the JavaScripts will be included twice on the page.

Remove everything from public/assets if in development mode.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号