module Formtastic::Helpers::FormHelper

Public Instance Methods

semantic_form_for(record_or_name_or_array, *args, &proc) click to toggle source

This is a replacement method for the original ‘semantic_form_for` method from `Formtastic`. The only thing it does, is merge the `form_record_for` into the output.

# File lib/page_record/formtastic.rb, line 61
def semantic_form_for(record_or_name_or_array, *args, &proc)
  extend(PageRecord::Helpers)
  options = args.extract_options!
  options ||= {}
  case record_or_name_or_array
  when String, Symbol
    object_name = record_or_name_or_array
  else
    object      = record_or_name_or_array.is_a?(Array) ? record_or_name_or_array.last : record_or_name_or_array
    raise ArgumentError, 'First argument in form cannot contain nil or be empty' unless object
    object_name = options[:as] || model_name_from_record_or_class(object).param_key
  end
  options = options.merge(html: form_record_for(object_name))
  args << options
  semantic_form_for_org(record_or_name_or_array, *args, &proc)
end
Also aliased as: semantic_form_for_org
semantic_form_for_org(record_or_name_or_array, *args, &proc)
Alias for: semantic_form_for