Module: VueRailsFormBuilder::FormHelper

Defined in:
lib/vue-rails-form-builder/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#vue_form_for(record, options = {}, &block) ⇒ Object



16
17
18
19
# File 'lib/vue-rails-form-builder/form_helper.rb', line 16

def vue_form_for(record, options = {}, &block)
  options[:builder] ||= VueRailsFormBuilder::FormBuilder
  form_for(record, options, &block)
end

#vue_form_with(**options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/vue-rails-form-builder/form_helper.rb', line 3

def vue_form_with(**options)
  unless respond_to?(:form_with)
    raise "Your Rails does not implement form_with helper."
  end

  options[:builder] ||= VueRailsFormBuilder::FormBuilder
  if block_given?
    form_with(options, &Proc.new)
  else
    form_with(options)
  end
end