Skip to content

Instantly share code, notes, and snippets.

View StefanHagen's full-sized avatar

Stefan Hagen StefanHagen

  • Ikbenfrits
  • Amsterdam, Netherlands
View GitHub Profile
@carlosantoniodasilva
carlosantoniodasilva / gist:709301
Created November 21, 2010 23:44
SimpleForm submit with cancel link example
module SimpleForm
class FormBuilder < ActionView::Helpers::FormBuilder
# You can just override the default submit button and add the functionality.
#
# Simple usage:
# f.button :submit 'Send!', :cancel_link => root_path
#
def submit(*args)
cancel_link = args.last.is_a?(Hash) && args.last.delete(:cancel_link)
submit_button = super