RailsCasts Pro episodes are now free!
Learn more or hide this
Resources
map.resources :tasks, :collection => { :complete => :put }
def complete Task.update_all(["completed_at=?", Time.now], :id => params[:task_ids]) end
<% form_tag complete_tasks_path, :method => :put do %> <ul> <% for task in @incomplete_tasks %> <li> <%= check_box_tag "task_ids[]", task.id %> <%= task.name %> </li> <% end %> </ul> <%= submit_tag "Mark as Complete" %> <% end %>