Can't find jquery

I'm using the jquery-rails gem. In a rails (non-mountable) engine I have in app/assets/javascripts/my_engine/application.js.erb:

//= require jquery
//= require jquery_ujs
//= require jquery-ui.min

And I get the error:

Sprockets::FileNotFound: couldn't find file 'jquery-ui.min'n  (in /home/me/rails/my_engine/app/assets/javascripts/my_engine/application.js.erb

The same set up was working fine in the container application. How is it that the manifest can find jquery and jquery_ujs but not jquery-ui.min?

I have the jquery-rails gem in my container app's Gemfile, in the engine's gemspec and in the engine's Gemfile and ran bundle install.


If you're using version 3.0.0 or newer of jquery-rails, jQuery UI has been removed from the gem.

See commit 2fdcdb2633cbc6426d412c050200fc31d14b9a3b.

It looks like the creators of jquery-rails recommend taking a look at the jquery-ui-rails gem if you still need jQuery UI in your app.


To use jquery.ui.all you need to add following gem in to your gemfile, not it is seprated from jquery_rails.

gem "jquery-ui-rails", "~> 4.0.5"

use following in your application.js to access

//= require jquery.ui.all

Best luck!


There's new syntax to include jquery ui.

Use //= require jquery.ui.all to include all modules, or you could specify just the core with //= require jquery.ui.core

more info at jquery-ui-rails gem page

链接地址: http://www.djcxy.com/p/81134.html

上一篇: 有没有办法在gem内创建rails应用程序?

下一篇: 找不到jquery