Module: Alchemy::Admin::FormHelper

Defined in:
app/helpers/alchemy/admin/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#alchemy_form_for(object, *args, &block) ⇒ Object

Use this form helper to render any form in Alchemy admin interface.

This is simply a wrapper for ‘simple_form_for`

Defaults

  • It uses Alchemy::Forms::Builder as builder

  • It makes a remote request, if the request was XHR request.

  • It adds the alchemy class to form



16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/alchemy/admin/form_helper.rb', line 16

def alchemy_form_for(object, *args, &block)
  options = args.extract_options!
  options[:builder] = Alchemy::Forms::Builder
  options[:remote] = request.xhr?
  options[:html] = {
    id: options.delete(:id),
    class: ["alchemy", options.delete(:class)].compact.join(" ")
  }
  simple_form_for(object, *(args << options), &block)
end