8

I'm trying to add jquery ui datepicker to my application with help of jquery-ui-rails gem. I've checked Railscast I seem to do everything right, but i get an error upon application startup
couldn't find file 'jquery.ui.all'

Gemfile(end of it, tried to include gem in the assets group but no luck):

gem 'backbone-on-rails'
gem "jquery-ui-rails"

application.js

//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
//= require jquery.ui.all

application.css

*= require jquery.ui.all
*= require_self
*= require_tree .
6
  • 1
    try putting it after jquery Commented Apr 8, 2013 at 8:16
  • Where exactly do you mean? Commented Apr 8, 2013 at 8:20
  • 1
    I've tried in application.js & application.css to put require lines at the bottom of require block. still get that error. Commented Apr 8, 2013 at 8:22
  • 2
    I mean, try putting //= require jquery.ui.all right after //= require jquery Commented Apr 8, 2013 at 8:28
  • 1
    I'll put that as answer, so other will get help as well Commented Apr 8, 2013 at 9:06

2 Answers 2

21

At version 5.0 it has been changed. You can read more about it here.

version 5.0:

application.js:

//= require jquery-ui

application.css:

/*
 *= require jquery-ui
 */

version 4.x (I'm sure about 4.2.0 and 4.2.1):

application.js:

//= require jquery.ui.all

application.css:

/*
 *= require jquery.ui.all
 */
Sign up to request clarification or add additional context in comments.

Comments

8

Put //= require jquery.ui.all right after //= require jquery so it will look like this

//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require underscore
//= require backbone
//= require svitla_test
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .

note that the order of which these lines are written is the order which these files are loaded.. So if you call a jquery-ui function before it knows what jquery-ui is, most likely you need to change the order a bit..

It is usually good to put infrastructure files before your own files to avoid these kind of problems

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.