Links that are really POSTs
I’m really not a fan of using GETs to call actions that create things like so.
<%= link_to image_tag('mini_icons/copy.png', :alt => 'Make a copy of this lesson'), copy_lesson_path(lesson), :method => :post %> <br/>
<%= link_to "Copy", copy_lesson_path(lesson), :method => :post %>
Despite using a form to pretend to be a link I much prefer this solution, because it actually enforces a POST to call the ‘copy’ action rather then pretending to be a post with a param { “_method” => “post” }
<% form_for lesson, :url => {:controller => '/lessons', :action => :copy, :id => lesson}, :html => { :method => :post, :class => 'button' } do |f| %>
<label for="copy">
<%= image_submit_tag('mini_icons/copy.gif', :alt => 'Copy Lesson', :id => 'copy') %>
<span>Copy</span>
</label>
<% end %>