Displaying 4 results from an estimated 4 matches for "add_rat".
Did you mean:
add_sat
2007 Oct 31
0
another question about acts_as_rateable
...''m
working on, I''ve been following a few tutorials (one being http://
www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/)
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 in...
2007 Jun 04
1
acts_as_rateable in Beast
...vote_up
return unless logged_in?
rateable = @rateable_class.find(params[:id])
# Delete the old ratings for current user
Rating.delete_all(["rateable_type = ? AND rateable_id = ? AND
user_id = ?", @rateable_class.base_class.to_s, params[:id],
@current_user.id])
rateable.add_rating Rating.new(:rating => 1, :user_id =>
@current_user.id)
end
Is there a way to dynamically update (ajax) the rating in my view
without having to refresh the page? I''ve tried link_to_remote and am
loading javascript files but it does not seem to be working, my partial
looks like...
2008 Aug 27
5
VALIDATION QUESTION
...d the ratecomment model but it does not work. I
know there are ways around this, suggestions anyone?
#########controller code
def rate
@furnii = Furni.find(params[:id])
Rating.delete_all(["rateable_type = ''Furni'' AND rateable_id = ?",
@furnii])
@furnii.add_rating Rating.new(:rating =>
params[:ratecomment]["rating"])
@comments = Ratecomment.new(params[:ratecomment])
if @comments.save
redirect_to furni_path(@furnii)
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~-...
2008 Jul 01
2
rateable plugin problem
...ocals => { :picture=> @picture }
Code at controller looks like:
------------------------------
def rate
@picture = Picture.find(params[:id])
Rating.delete_all(["rateable_type = ''Picture'' AND rateable_id = ? AND
user_id = ?",
@picture.id, current_user.id])
@picture.add_rating Rating.new(:rating => params[:rating],
:user_id => current_user.id)
end
end
Any help would be appreciated. thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups &q...