I have a column hit in my responses table, and I need to create a
button beside every response. And when the button is clicked, the
counter value should be incremented and displayed on the same page.
I created a method in mycontroller,
def update_hit @response.update_attribute :hit, params[:count] + 1
end
and in the view
<%= button_to “Click” , response, :action => update_hit %>
I am not sure if I am doing it the right way. What can I do about
this?
I have a column hit in my responses table, and I need to create a
button beside every response. And when the button is clicked, the
counter value should be incremented and displayed on the same page.
I created a method in mycontroller,
def update_hit @response.update_attribute :hit, params[:count] + 1
end
and in the view
<%= button_to “Click” , response, :action => update_hit %>
I am not sure if I am doing it the right way. What can I do about
this?
Why don’t you think you’re doing it right? What’s the problem?