Nerian / bootstrap-datepicker-rails

A Datepicker for Twitter Bootstrap, integrated with Rails assets pipeline
MIT License
649 stars 182 forks source link

couldn't find file 'bootstrap-datepicker' #70

Closed rahuldess closed 10 years ago

rahuldess commented 10 years ago

I did as mentioned.

Gemfile:

gem 'bootstrap-datepicker-rails' # For showing calender in date fields insane gem 'bootstrap-sass' gem 'jquery-rails' gem 'devise' gem 'carrierwave'

application.css

= require jquery.Jcrop = require_self = require bootstrap-datepicker = require_tree .

application.js

//= require jquery //= require jquery_ujs //= require jquery.Jcrop //= require bootstrap //= require_tree . //= require bootstrap-datepicker

datepick.js

$(document).ready(function(){ $('[data-behaviour~=datepicker]').datepicker(); });

I dint even include the .js file in my view code.. i just wanted to test whether everything is fine till now.. when i run the server ...i get below

Sprockets::FileNotFound in Users#show

Showing /home/rahul/Rails/ORIGINAL/app/views/layouts/profile.html.erb where line #13 raised:

couldn't find file 'bootstrap-datepicker' (in /home/rahul/Rails/ORIGINAL/app/assets/stylesheets/application.css:13)

Nerian commented 10 years ago

Hi,

I don't see anything wrong.

You can use this app to compare what with how your code looks like:

https://github.com/Nerian/bootstrap-datepicker-rails/blob/master/testapp/app/assets/stylesheets/application.css

prestonwrthompson commented 10 years ago

try restarting the server - ran into the same problem and that fixed it

reggieb commented 10 years ago

I have been getting the same problem with a Rails 4.1 app, where bootstrap-datepicker-rails was being called as a dependancy of a gem. I fixed it by adding this to my app:

require 'bootstrap-datepicker-rails'
jyothu commented 10 years ago

@reggieb Where did you add this line require 'bootstrap-datepicker-rails' ? I added the same in application.rb . Still datepicker is not working.

reggieb commented 10 years ago

I was working on a engine called wcc_style (private I'm afraid) that had bootstrap-datepicker-rails as a dependency. I put the require statement at the beginning of the engine namespace file lib/wcc_style.rb

I'd suggest putting it in an initializer.

jyothu commented 10 years ago

@reggieb Thanks.

sstensberg commented 9 years ago

@prestonwrthompson I was having the same issue and your suggestion to restart the server saved me from hours of frustration! :)

Johnfredadams commented 9 years ago

Same problem here in an engine for rails 4.2.1. Have done the as @reggieb suggested. Works well.

benkoshy commented 8 years ago

Same problem.

@reggieb - thank you - would you be able to elaborate on what you mean by putting "require 'bootstrap-datepicker-rails' in an initializer?

I'd suggest putting it in an initializer.

reggieb commented 8 years ago

@BKSpurgeon If you are using rails, try creating an initializer config/initializers/bootstrap-datepicker-rails.rb with the content:

require 'bootstrap-datepicker-rails'
Nerian commented 8 years ago

It should just get autorequired, if using Rails. Try reloading the app.