在Rails 5.1中仍然需要`require jquery_ujs`吗? [英] Is `require jquery_ujs` still needed in Rails 5.1?
问题描述
我正在通过jquery-rails
gem在5.1.x
Rails应用程序中安装jQuery.
I am installing jQuery in my 5.1.x
Rails app via the jquery-rails
gem.
在gem设置中,他们建议默认情况下将以下行添加到application.js
:
In the gem setup, they recommend to add these lines to application.js
by default:
//= require jquery
//= require jquery_ujs
但是,在Rails 5.1.x
应用程序中,您已经有了以下行,不再依赖jQuery:
But, in a Rails 5.1.x
app, you have already this line which doesn't depend on jQuery anymore:
//= require rails-ujs
我想两个人都在做完全相同的事情,不需要.
I suppose both are doing the exact same thing and one is not needed.
我还是应该保留两者,还是只应该选择jquery_ujs
还是rails-ujs
?
Should I keep both anyway or should I prefer only jquery_ujs
or only rails-ujs
?
推荐答案
jquery-ujs
自 Rails 5.1 起已成为过去,您不需要它.
jquery-ujs
is a thing of the past as of Rails 5.1, you don't need it.
这篇关于在Rails 5.1中仍然需要`require jquery_ujs`吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!