I have a helper which puts a form_for in the view (from holding it in an ERB tag). It looks like this;
ERB.new(%{ <% form_for(following, :url => user_follower_path(followee, follower)) do |f| %> <%= f.hidden_field :status, :value => 0 %> <%= f.submit 'Block', :class => "bar_button block_button" %> <% end %> }).result(binding)
I want to replace this with a link_to, but I don't know if a link_to could handle the status change that is sent (using the hidden_field tag) through the form_for. This example doesn't work, but I was wondering if someone knows how I can achieve something similar(?);
"#{link_to "Block", {:controller => "followers", :action => "update", :user_id => followee, :id => follower, :status => 0}, :confirm => "Are you sure?", :class => "bar_button block_button"}"
Another option is to keep the form_for but to use a link_to to perform the submit on the form. Essentially, we're trying to avoid having an input element in the DOM - we just want a simple anchor tag. Is this possible?