Module: Riveter::CommandFormHelper

Defined in:
app/helpers/riveter/command_form_helper.rb

Instance Method Summary collapse

Instance Method Details

#command_form_for(command, options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/riveter/command_form_helper.rb', line 3

def command_form_for(command, options={}, &block)
  command_class_name = command.class.name.underscore
  options = {
    :as => command_class_name.gsub(/_command$/, ''),
    :url => command_class_name.gsub(/_command$/, '')
  }.merge(options)

  respond_to?(:simple_form_for) ?
    simple_form_for(command, options, &block) :
    form_for(command, options, &block)
end