I went through the walkthrough you linked to, and got past the issue you
encountered…
The error you are seeing has to do with the the fact that the partial is
referring to asset. You probably want to change that to something else
(as well as in the RJS code and the controller).
You also want to be careful with the line:
Rating.delete_all([“rateable_type = ‘Posting’ AND rateable_id = ? AND
user_id = ?”, @posting.id, current_user_id.to_s])
current_user_id is a string in the migration described
If you (or anyone else) wants to see the code I came up with, please
email me… I wrote a very simple app that lets you create postings
using scaffolding, and vote on them… The only thing that I’m not happy
with is that after voting, the post name disappears! (and I am pretty
sure that has to do with the fact that the rate controller needs to do
something else that I’m not doing, but I’m not 100% sure…
it seems everything is fine but how do i make it so after the user
rates, it takes away there ability to change the rating? i want to
display something like, :sorry you rated already etc…"
but what i did is changed current_user.id to the params[:id] (which is
my address ID)
Post again if you feel any of your questions have not been answered
Thanks!
Dominique
koloa wrote:
im almost there.
it seems everything is fine but how do i make it so after the user
rates, it takes away there ability to change the rating? i want to
display something like, :sorry you rated already etc…"
but what i did is changed current_user.id to the params[:id] (which is
my address ID)
how do i use this? do all sessions have user or do i have to define it
in a session model?
do i put this code in the rate function and if its true, return and do
nothing? else, record the rating?
thanks Dominique
i still have a few questions about the plugin…
what is rateable_id and user_id in the rateable table? in my rate
function, rateable_type = my model name, rateable_id = my model id, and
user_id = also my model id.
Hi Dominique,
I read your post and was hoping that you could share your rating
system code or tips.
I am putting up a college survey site and need users to rate the
surveys.
I am looking at implementing rating display, number of votes, etc.
Also, i see that you have “listing with number of views” as well on
your site.
Could you please let me know how you implmented it?
Thanks in advance!
Cheers!
Vish
On Sep 23 2006, 12:19 pm, Dominique P. <rails-mailing-l…@andreas-
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.