motion/model/formotion.rb
def new_to_formotion(options = {form_title: nil, sections: []})
      form = {}

      @expose_auto_date_fields = options[:auto_date_fields]

      fields = returnable_columns
      form[:title] = options[:form_title] unless options[:form_title].nil?
      fill_from_options(form, options) if options[:sections]
      form
    end
def new_to_formotion(options = {form_title: nil, sections: []})
      form = {}

      @expose_auto_date_fields = options[:auto_date_fields]

      fields = returnable_columns
      form[:title] = options[:form_title] unless options[:form_title].nil?
      fill_from_options(form, options) if options[:sections]
      form
    end
def new_to_formotion ( options = { form_title : nil , sections : [ ] } ) form = { } @expose_auto_date_fields = options [ :auto_date_fields ] fields = returnable_columns form [ :title ] = options [ :form_title ] unless options [ :form_title ] . nil? fill_from_options ( form , options ) if options [ :sections ] form end
<tt>new_to_formotion</tt> maps a MotionModel into a hash in a user-definable
 manner, according to options.

 form_title:    String for form title
 sections:      Array of sections

 Within sections, use these keys:

 title:         String for section title
 field:         Name of field in your model (Symbol)

 Hash looks something like this:

 {sections: [
   {title:  'First Section',           # First section
    fields: [:name, :gender]           # contains name and gender
   },
   {title:  'Second Section',
    fields: [:address, :city, :state],  # Second section, address
    {title: 'Submit', type: :submit}    # city, state add submit button
   }
 ]}
<tt > new_to_formotion< / tt > maps a MotionModel into a hash in a user - definable manner according to options .