I have a rails form that creates (and updates) materials. Obviously, by default, when the user is logged in and the materials is retrieved the form renders with the update action. However, I want to have a "save as" action in case the user wants to save another version of the material. The obvious way to do this is to have one button which sends to 'update' in the controller and another which sends to 'new', but I don't know how to do this since it seems to depend on the form_for parameters.
Update
To avoid using Javascript I tried changing the form_for url to:
<%= form_for @material, :url => choose_action_path do |f| %>
Then in the controller I have:
def choose_action
if params[:save_as] == "Save As"
redirect_to :action => "create"
else
redirect_to :action => "update"
end
end
but this is not working. Is this a strategy that could work or is this crazy?