Skip to content

Commit

Permalink
Use record_name to make fields for methods more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed May 15, 2011
1 parent f0479cb commit 82f33dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions actionpack/lib/action_view/helpers/form_helper.rb
Expand Up @@ -584,8 +584,8 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# <% end %>
# ...
# <% end %>
def fields_for(record, record_object = nil, options = {}, &block)
builder = instantiate_builder(record, record_object, options, &block)
def fields_for(record_name, record_object = nil, options = {}, &block)
builder = instantiate_builder(record_name, record_object, options, &block)
output = capture(builder, &block)
output.concat builder.hidden_field(:id) if output && options[:hidden_field_id] && !builder.emitted_hidden_id?
output
Expand Down Expand Up @@ -898,13 +898,13 @@ def range_field(object_name, method, options = {})

private

def instantiate_builder(record, record_object, options, &block)
case record
def instantiate_builder(record_name, record_object, options, &block)
case record_name
when String, Symbol
object = record_object
object_name = record
object_name = record_name
else
object = record
object = record_name
object_name = ActiveModel::Naming.param_key(object)
end

Expand Down

0 comments on commit 82f33dc

Please sign in to comment.