Method: EffectiveResourcesHelper#effective_submit

Defined in:
app/helpers/effective_resources_helper.rb

#effective_submit(form, options = {}, &block) ⇒ Object

effective_bootstrap



5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/effective_resources_helper.rb', line 5

def effective_submit(form, options = {}, &block)
  actions = controller.try(:submits) || raise('controller must be an Effective::CrudController')
  actions = actions.select { |k, v| v[:default] != true } if options.delete(:defaults) == false
  actions = permitted_resource_actions(form.object, actions)

  submits = actions.map { |name, opts| form.save(name, opts.except(:action, :title, 'data-method') ) }.join.html_safe

  form.submit('', options) do
    (block_given? ? capture(&block) : ''.html_safe) + submits
  end
end