5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/client_side_validations/action_view/form_helper.rb', line 5
def form_for(record_or_name_or_array, *args, &proc)
options = args.
if options[:validate]
if options[:builder].to_s == 'SimpleForm::FormBuilder'
options[:html][:novalidate] = true
end
case record_or_name_or_array
when String, Symbol
raise ClientSideValidations::ActionView::Helpers::FormHelper::Error, 'Using form_for(:name, @resource) is deprecated in Rails and is not supported with ClientSideValidations. Please use form_for(@resource, :as => :name) instead.'
when Array
object = record_or_name_or_array.last
else
object = record_or_name_or_array
end
end
script_tag = client_side_form_js_variable(object, options)
"#{super(record_or_name_or_array, *(args << options), &proc)}#{script_tag}".html_safe
end
|