I’ve been trying to add some rating capabilities to a site I’m
working on, I’ve been following a few tutorials (one being http://
Acts As Rateable Plugin | Juixe Techknow)
and I keep seeing something that’s confusing me.
---- from the tute : (in my ratings controller)
post = Post.find(params[:id])
post.add_rating Rating.new(:rating => 2)
If I place this in my code and update to match my models in my logs I
see the error - undefined method `add_rating’
Looking through the acts_as_rateable documentation I’m not seeing
that method either.
If I alter the code to use the rate method instead of add_rating: (in
my ratings controller)
post = Post.find(params[:id])
post.rate(:rating => 2)
It works and updates the db table and changes that posts rating.
The issue with my workaround is that it is overwriting the value - so
each posts rating is only whatever was last added. Has anyone run
into this? How would I get the add_rating method, also I’ve just
noticed that my Model ends up with a rating, but not ratings?
Anybody run into these issues, any pointers on how to get this
running?
thanks in advance!