method
apply_form_for_options!
v4.0.2 -
Show latest stable
- Class:
ActionView::Helpers::FormHelper
apply_form_for_options!(record, object, options)private
No documentation available.
# File actionpack/lib/action_view/helpers/form_helper.rb, line 441
def apply_form_for_options!(record, object, options) #:nodoc:
object = convert_to_model(object)
as = options[:as]
action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]
options[:html].reverse_merge!(
class: as ? "#{action}_#{as}" : dom_class(object, action),
id: as ? "#{action}_#{as}" : [options[:namespace], dom_id(object, action)].compact.join("_").presence,
method: method
)
options[:url] ||= polymorphic_path(record, format: options.delete(:format))
end