mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Speed up form_for by specializing extract_options! (at asakusa.rb)
This commit is contained in:
@@ -519,16 +519,18 @@ module ActionView
|
||||
# Delete: <%= project_fields.check_box :_destroy %>
|
||||
# <% end %>
|
||||
# <% end %>
|
||||
def fields_for(record_or_name_or_array, *args, &block)
|
||||
def fields_for(record, record_object = nil, options = nil, &block)
|
||||
raise ArgumentError, "Missing block" unless block_given?
|
||||
options = args.extract_options!
|
||||
|
||||
case record_or_name_or_array
|
||||
options, record_object = record_object, nil if record_object.is_a?(Hash)
|
||||
options ||= {}
|
||||
|
||||
case record
|
||||
when String, Symbol
|
||||
object_name = record_or_name_or_array
|
||||
object = args.first
|
||||
object = record_object
|
||||
object_name = record
|
||||
else
|
||||
object = record_or_name_or_array
|
||||
object = record
|
||||
object_name = ActiveModel::Naming.singular(object)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user