3

I have tried multiple answers on stackoverflow and non seem to work, but here is the question anyways.

Im trying to use active-admin with my Rails 5 application.

In my gem file I have:

gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin'
gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources'
gem 'jquery-ui-rails'

In my application.js I have:

//= require jquery
//= require bootstrap-sprockets
//= require ckeditor/init
//= require jquery-ui
//= require jquery-ui/datepicker
//= require jquery_ujs
//= require turbolinks
//= require_tree .

In my application.scss I have:

@import "jquery-ui";
@import "jquery-ui/datepicker";

Despite following all the instructions as stated I'm getting an error:

couldn't find file 'jquery-ui/datepicker' with type 'application/javascript

and the error seems to be happening here:

//= require jquery-ui/datepicker

EDIT

I have a redirect in the action_controller.rb

  def after_sign_in_path_for(user)
    home_mypath_path
  end

Which I think is interfering with the login.

3 Answers 3

7

The newest version of jquery-ui has restructured the library.

Try the following:

//= require jquery-ui/widgets/datepicker

And

@import "jquery-ui/widgets/datepicker";
Sign up to request clarification or add additional context in comments.

3 Comments

i still get an error File to import not found or unreadable: jquery-ui/widgets/datepicker
this is the right answer if you want to use jquery-rails with version 6.0 above,
For Rails 5 users, do not change the application.scss file. I just needed to add /widgets/ to my application.js file, then it worked.
6

just require the old jquery-ui-rails version:

gem 'jquery-ui-rails', '5.0.5'
gem 'activeadmin', '~> 1.0.0.pre4'

put it before activeadmin. this works for rails 5.

from the jquery-ui-rails github page:

Warning: Due to directory structure changes between jQuery UI 1.10, 1.11, and 1.12, if you use version is lower than 6.0, you will have to use a different naming for the files to require, please check following links for more information: for 5.0 users, for 4.2 users.

3 Comments

This solution takes me past the error, but now it redirects me back to the home page
@GurmukhSingh dude you could easily accept my answer. thanks
FYI all versions of jquery-ui-rails < 6.0.0 are vulnerable to XSS. security.snyk.io/vuln/SNYK-RUBY-JQUERYUIRAILS-449592
0

helped me as well

bundle exec rails assets:precompile

Comments

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.