Flowdock
apply_form_for_options!(object_or_array, options) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/helpers/form_helper.rb, line 324
      def apply_form_for_options!(object_or_array, options) #:nodoc:
        object = object_or_array.is_a?(Array) ? object_or_array.last : object_or_array
        object = convert_to_model(object)

        html_options =
          if object.respond_to?(:persisted?) && object.persisted?
            { :class  => options[:as] ? "#{options[:as]}_edit" : dom_class(object, :edit),
              :id => options[:as] ? "#{options[:as]}_edit" : dom_id(object, :edit),
              :method => :put }
          else
            { :class  => options[:as] ? "#{options[:as]}_new" : dom_class(object, :new),
              :id => options[:as] ? "#{options[:as]}_new" : dom_id(object),
              :method => :post }
          end

        options[:html] ||= {}
        options[:html].reverse_merge!(html_options)
        options[:url] ||= options[:format] ? \
          polymorphic_path(object_or_array, :format => options.delete(:format)) : \
          polymorphic_path(object_or_array)
      end
Register or log in to add new notes.