andrew, the problem i see is that you depend on the label of the button.
if a user wants to change the label of one button, let's say to "Abort",
then it requires another method for this particular button.
using
<%= submit_tag 'Any Label', :name => 'cancel' %>
and
def check_for_cancel
unless params[:cancel].blank?
redirect_back_or_default.......
end
end
you can avoid that.
Andrew Porter wrote:
>
> I use a filter -
> before_filter :check_for_cancel, :only => [:create, :update]
>
> and a method
>
> def check_for_cancel
> if params[:commit] == 'Cancel'
> redirect_back_or_default.......
> end
> end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---