module ActionView::Helpers::MagicFormHelper

Public Instance Methods

magic_form(*resources) click to toggle source
# File lib/magic_form.rb, line 10
def magic_form(*resources)
  options = resources.extract_options!
  resource = resources.last
  attributes = resource.attribute_names - ["created_at", "updated_at"]

  form_for(resources) do |f|
    attributes.each do |attribute|
      concat(f.label attribute, options[attribute.to_sym])
      concat(f.text_field attribute)
    end
    concat(f.submit)
  end
end