Search code examples
jqueryruby-on-railsruby-on-rails-4herokuraty

Ratyrate stars not loading in production (heroku)


So ive got ratyrate working in development just fine by adding

<%= javascript_include_tag 'ratyrate.js', "data-turbolinks-track" => false %>

to the body of my view. Prior to this the stars would only load when the url was directly accessed or the page refreshed.

Now I am having the exact same issue (stars not loading when page is accessed through a link) when deploying my app on heroku!

I hope that this is enough info (happy to provide more) and that someone has faced this before/has any ideas! Thanks!

solved - see answer


Solution

  • So the problem was that I forgot to run rake assets:precompile. The solution for development mentioned in the question should work.

    SOLUTION

    Add <%= javascript_include_tag 'ratyrate.js', "data-turbolinks-track" => false %> to the head (seems to run faster) or body tag in your view.

    Also add Rails.application.config.assets.precompile += %w( ratyrate.js ) to config/initializers/assets.rb.

    Then make sure you run rake assets:precompile to avoid looking as silly as me!

    Hope this helps someone :)