Module: SmartButtons::PatchButton

Included in:
SmartButtons
Defined in:
lib/smart_buttons/patch_button.rb

Instance Method Summary collapse

Instance Method Details

#patch_button(**options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/smart_buttons/patch_button.rb', line 4

def patch_button(**options)
  simple_form_for options[:record], url: options[:url], method: :patch, html: options[:form_options] do |f|
    options[:attributes].each do |attr|
      concat build_input attr, options, f
    end
    concat(button_tag(type: :submit, **options[:button_options]) do
      yield if block_given?
    end)
  end
end