About ruby on rails, hackintosh, iphone3g and etc.

Thursday, December 3, 2009

Enable Multiple Buttons in a Form in Rails

Sometimes we need more than one button in the form. To do so in Ruby On Rails, we have to do the following:

Create a method in the controller to accept the form input
e.g

def approve_form
case params[:submit]
when "Approve"
redirect_to :action=>"approve"
return
when "Reject"
redirect_to :action=>"reject"
return
end
end


in your form, do this

No comments: