Module: HatTrick::FormHelper

Defined in:
lib/hat_trick/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#wizard_form_for(record, *args, &proc) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hat_trick/form_helper.rb', line 3

def wizard_form_for(record, *args, &proc)
  options = args.extract_options!
  options[:html] = { :class => 'wizard' }

  wizard = controller.send(:hat_trick_wizard)
  wizard.start unless wizard.started?

  options[:url] = wizard.current_form_url
  options[:method] = wizard.current_form_method.to_sym

  output = ActiveSupport::SafeBuffer.new
  output.safe_concat(wizard_partial)

  # now run the default FormBuilder & append to output
  output << self.form_for(record, *(args << options), &proc)
end