Displaying 1 result from an estimated 1 matches for "countercontroller".
2007 Feb 24
2
RESTful PUT and button_to
...t; view, I''d like to put a link which
increments the counter by one:
<%= h @counter.content %>
<%= button_to "++", ??? %>
If this were a traditional rails app, the next step would be obvious.
I''d add an "increment" action to the controller:
CounterController
...
def increment
@counter = Counter.find(params[:id])
@counter.count += 1
@counter.save
redirect_to :action => "show"
end
end
And I''d link the action to the controller:
<%= h @counter.content %>
<%= button_to "++"...