muratguzel / letsrate

The best way to add rating capabilities to your rails application and your activerecord models.
http://letsrate.herokuapp.com
198 stars 234 forks source link

rating_for_user with disable_after_rate => true get `ratings_given' for 22:Fixnum error #45

Open arthurccube opened 10 years ago

arthurccube commented 10 years ago

my call " rating_for_user ratable, user, r, :disable_after_rate => true"

gives the following errors, which disappear without the disable_after_rate

undefined method `ratings_given' for 22:Fixnum

Extracted source (around line #18):

15: %lable=t("activerecord.attributes.rating.#{r}") 16: .rating_wrapper 17: - if user.present? 18: = rating_for_user ratable, user, r, :disable_after_rate => true 19: - else 20: = rating_for ratable, r, :disable_after_rate => true 21:

Application Trace | Framework Trace | Full Trace

app/views/ratings/_ratable.haml:18:in block in _app_views_ratings__ratable_haml___940430013_100816650' app/views/ratings/_ratable.haml:13:ineach' app/views/ratings/_ratable.haml:13:in _app_views_ratings__ratable_haml___940430013_100816650' app/views/students/opinions/_nav_bar.haml:19:in_app_views_students_opinions__nav_bar_haml_121796833_107698390' app/views/students/opinions/show.html.haml:15:in `_app_views_students_opinions_show_html_haml499083187_105337980' app/controllers/students/opinions_controller.rb:16:in`show'

guan commented 10 years ago

i got same issues too

aalmazyad commented 8 years ago

Same here

conquering-lion commented 7 years ago

pass just current_user and not current_user.id to obj.rate