I have this code to implement a thumbs up/down
functionality in my rails app
if params[:vote][:type] == "up"
answer = Answer.find_by_id(params[:vote][:id])
answer.increment(:ups)
render text: answer.ups
end
if params[:vote][:type] == "down"
answer = Answer.find_by_id(params[:vote][:id])
answer.increment(:downs)
render text: answer.downs
end
It doesn't give any error but the incremented value is not updated in the DB.
This code works properly in rails console.
Please help,
Thanks in advance