Rails 3.1 远程请求提交两次
我开发了一个 Rails 3.1 应用程序,其中包含用于输入用户和客户的 100% Ajax CRUD 表单。我创建了两个单独的模型、控制器、视图等。每个模型的视图都包含用于创建、编辑、更新和销毁的 jquery 文件。问题是当我执行任何执行远程操作的操作时,它会被调用两次。我可以在 firebug 的控制台视图以及 WEBrick 输出中确认这种情况发生。任何人都可以协助追查这里发生了什么吗?什么会导致 Rails 处理每个调用两次?
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 firebug 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将
config.serve_static_assets = false
添加到development.rb
将阻止从/public/assets
加载文件。实际上,我需要在本地预编译,因为我的测试模式仅使用
/public/assets
中的静态资产 - 测试正在捕获可能的生产资产问题。如何?只需在test.rb
配置中设置config.assets.compile = false
和config.serve_static_assets = true
即可。Adding
config.serve_static_assets = false
todevelopment.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 setconfig.assets.compile = false
andconfig.serve_static_assets = true
intest.rb
configuration.如果您已预编译资源并在开发模式下运行,则 JavaScript 将在页面上包含两次。
如果处于开发模式,请从
public/assets
中删除所有内容。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.