Rails gem Ratyrate showings stars only after refresh and not saving

544 Views Asked by At

(Saw many posts with these problems and got it working, so I will upload solution)

I'm using Ratyrate without Devise and the stars only appear after a web refresh and they do not save the previously assigned rate.

1

There are 1 best solutions below

0
Diiru On

Fixed this issue with:

  1. Specifying version in each Rating Migration (currently using ActiveRecord::Migration[5.1])

  2. Changing Rate Controller "create" method, replacing "if user_signed_in?" with "if current_user"

  3. Adding "post '/rate' => 'rater#create', :as => 'rate'" to routes.rb (gem should do this for you)

  4. Adding <%= javascript_include_tag 'ratyrate.js', "data-turbolinks-track": false %> at the bottom of show.html.erb (the view of the model you want to rate)

Hope this helps !