Reputation: 2293
Within my rails 4 app, i'm trying to set a countdown in one of my views.
I've tried using this gem: https://github.com/jnbt/countdown
In my gem file I added:
gem 'countdown'
I then ran bundle install which ran smoothly.
Then I added this in my application.js file:
//= require countdown
And then I tried running this from the terminal as instructed:
rails generate countdown:install
Which resulted in this error:
Could not find generator countdown:install
I then added this tag in my application.html.erb file:
<%= javascript_include_tag 'countdown' %>
And finally in my view, I added:
<%= countdown Time.now + 28.hours %>
Which is giving me this error:
Sprockets::FileNotFound in Posts#index
couldn't find file 'countdown'
What is causing this? Is there any alternative to this gem? I would just like as simple countdown in my view. Can I just use some other javascript countdown? (I'm just worried about the countdown starting from when the user refreshes the browser, I need it to start from a permanent point, a particular date and time)
Upvotes: 2
Views: 3407
Reputation: 11499
The docs say the generator file simply copies countdown.js to the public/javascripts directory. You should be able to do that yourself. Just copy the code at:
https://bitbucket.org/mckamey/countdown.js/raw/tip/countdown.js
Create a file public/javascripts/countdown.js
and paste in the code.
Upvotes: 1