motion/model/formotion.rb
def to_formotion(form_title = nil, expose_auto_date_fields = false, first_section_title = nil)
      return new_to_formotion(form_title) if form_title.is_a? Hash

      @expose_auto_date_fields = expose_auto_date_fields

      sections = {
        default: {rows: []}
      }
      if respond_to? 'formotion_sections'
        formotion_sections.each do |k,v|
          sections[k] = v
          sections[k][:rows] = []
        end
      end
      sections[:default][:title] ||= first_section_title

      returnable_columns.each do |column|
        value = value_for(column)
        h = default_hash_for(column, value)
        s = column(column).options[:formotion] ? column(column).options[:formotion][:section] : nil
        if s
          sections[s] ||= {}
          sections[s][:rows].push(combine_options(column,h))
        else
          sections[:default][:rows].push(combine_options(column, h))
        end
      end

      form = {
        sections: []
      }
      form[:title] ||= form_title
      sections.each do |k,section|
        form[:sections] << section
      end
      form
    end
def to_formotion(form_title = nil, expose_auto_date_fields = false, first_section_title = nil)
      return new_to_formotion(form_title) if form_title.is_a? Hash

      @expose_auto_date_fields = expose_auto_date_fields

      sections = {
        default: {rows: []}
      }
      if respond_to? 'formotion_sections'
        formotion_sections.each do |k,v|
          sections[k] = v
          sections[k][:rows] = []
        end
      end
      sections[:default][:title] ||= first_section_title

      returnable_columns.each do |column|
        value = value_for(column)
        h = default_hash_for(column, value)
        s = column(column).options[:formotion] ? column(column).options[:formotion][:section] : nil
        if s
          sections[s] ||= {}
          sections[s][:rows].push(combine_options(column,h))
        else
          sections[:default][:rows].push(combine_options(column, h))
        end
      end

      form = {
        sections: []
      }
      form[:title] ||= form_title
      sections.each do |k,section|
        form[:sections] << section
      end
      form
    end
<tt>to_formotion</tt> maps a MotionModel into a hash suitable for creating
 a Formotion form. By default, the auto date fields, <tt>created_at</tt>
 and <tt>updated_at</tt> are suppressed. If you want these shown in
 your Formotion form, set <tt>expose_auto_date_fields</tt> to <tt>true</tt>

 If you want a title for your Formotion form, set the <tt>form_title</tt>
 argument to a string that will become that title.