17

I've just done a fresh install and was able to access the default rails page at localhost:3000, but when I installed the activeadmin gem I had a problem when accessing /admin/ and received the following error on /admin/login (I was redirected, but this is what I saw on the page:)

What do I do? I have done bundle update and it's not fixed it.

Here's the partial error message:

Sprockets::FileNotFound in Active_admin/devise/sessions#new

Showing /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activeadmin->0.6.0/app/views/layouts/active_admin_logged_out.html.erb where line #12 raised:

couldn't find file 'jquery-ui' (in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activeadmin->0.6.0/app/assets/javascripts/active_admin/base.js:2)

here is my gem file:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'activeadmin'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
2
  • 2
    show your application.js file Commented Jun 11, 2013 at 20:59
  • 1
    @uDaY: active_admin uses its own manifest - the application.js file shouldn't matter here. Commented Jun 11, 2013 at 21:01

4 Answers 4

30

This is a known issue due to the jquery-rails dependency dropping jQuery-UI support. The workaround for the moment appears to be to force the jquery-rails gem to load using version 2.3.0:

gem 'jquery-rails', '~> 2.3.0'

A related problem due to this: Debug jQueryUI Versions in Rails.

Sign up to request clarification or add additional context in comments.

2 Comments

@markhorrocks: Then it's probably not the same cause - feel free to ask a question regarding the problem you are experiencing
If you're in my shoes and this didn't work: make sure you don't have the gem jrails installed, it will conflict with jquery-rails with no helpful error to tell you so. I was upgrading to Rails 3.
10

If you are using later versions of jquery-ui-rails in my case jquery-ui-rails-5.0.0

I found out in the jquery-ui-rails-5.0.0 assets folder, that writing the following line into your application.css:

*= require jquery-ui

fetches all ui elements for your css, it simply calls:

*= require jquery-ui/all

and if you write the following into your application.js

//= require jquery-ui

it fetches most jquery js files, with exception of some specific datepickers, there is no #all method for jquery in application.js, in most cases these would do, but if not, then you can add the rest diretcly into applications.js e.g

//=require jquery-ui/datepicker-ru

So in summary to use all ui for both css and js

*= require jquery-ui
//= require jquery-ui

2 Comments

Resolved my issue, as I upgraded the jquery-ui-rails to 5.0.0 . Thanks
This worked for me. Pay attention to the 'dashes' in this answer (i.e "jquery.ui" should be "jquery-ui", as this answer correctly indicates).
4

I would suggest updating your application.js from: //= require jquery_ui to //= require jquery.ui.all as the preferable solution (rather than using an outdated version of the gem).

1 Comment

As the OP stated, this is occuring within the /admin namespace due to the manifest in active_admin. Modifying application.js won't help - you would need to copy over the active_admin asset tree and make the modifications there. That's fairly intrusive and quite a headache to maintain for updates.
2

Adding the jquery-ui-rails gem will also give you jquery.ui support.

gem 'jquery-ui-rails'

In your application.js and application.css files, you can add all modules

jquery.ui.all

or only the ones you need, e.g.:

jquery.ui.slider

3 Comments

Correct - 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][1] [1]: github.com/joliss/jquery-ui-rails
I think that Roger's comment is now out of date (as of Aug 2014) on Rails 4.1.
Yep! New syntax is now //= require jquery-ui.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.