Reputation: 13548
So I have this button:
<%= button_to "+1", video_votes_path( :video_id => video.id, :type => "up" ), :remote => true %>
It calls the create method in the video_votes controller, and also sets params[:type]. I want to turn this button into a link so that is does exactly the same thing. How do I do this?
Upvotes: 0
Views: 550
Reputation: 83680
button_to "+1", video_votes_path( :video_id => video.id, :type => "up" ), :remote => true
=>
link_to "+1", video_votes_path( video, :type => "up"), :remote => true, :method => :post
Upvotes: 1
Reputation: 4478
Change button_to
to link_to_remote
with an extra parameter: :method => :post
, and take out the remote
.
Uh, leave out the method
if you want a GET.
Upvotes: 0