Skip to content
Browse files

FormHelper correctly passes its object through select, collection_sel…

…ect, country_select, and time_zone_select.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3156 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent d21ba5a commit 130c493a4ff295723fa08935c71b89badef06cdc @jeremy jeremy committed Nov 22, 2005
View
4 actionpack/lib/action_view/helpers/form_helper.rb
@@ -317,7 +317,9 @@ def object
end
def value
- object.send(@method_name) unless object.nil?
+ unless object.nil?
+ object.send(@method_name)
+ end
end
def value_before_type_cast
View
8 actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -60,17 +60,17 @@ module FormOptionsHelper
# This allows the user to submit a form page more than once with the expected results of creating multiple records.
# In addition, this allows a single partial to be used to generate form inputs for both edit and create forms.
def select(object, method, choices, options = {}, html_options = {})
- InstanceTag.new(object, method, self).to_select_tag(choices, options, html_options)
+ InstanceTag.new(object, method, self, nil, options.delete(:object)).to_select_tag(choices, options, html_options)
end
# Return select and option tags for the given object and method using options_from_collection_for_select to generate the list of option tags.
def collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})
- InstanceTag.new(object, method, self).to_collection_select_tag(collection, value_method, text_method, options, html_options)
+ InstanceTag.new(object, method, self, nil, options.delete(:object)).to_collection_select_tag(collection, value_method, text_method, options, html_options)
end
# Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
- InstanceTag.new(object, method, self).to_country_select_tag(priority_countries, options, html_options)
+ InstanceTag.new(object, method, self, nil, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options)
end
# Return select and option tags for the given object and method, using
@@ -82,7 +82,7 @@ def country_select(object, method, priority_countries = nil, options = {}, html_
# zone model object. (See #time_zone_options_for_select for more
# information.)
def time_zone_select(object, method, priority_zones = nil, options = {}, html_options = {})
- InstanceTag.new(object, method, self).to_time_zone_select_tag(priority_zones, options, html_options)
+ InstanceTag.new(object, method, self, nil, options.delete(:object)).to_time_zone_select_tag(priority_zones, options, html_options)
end
# Accepts a container (hash, array, enumerable, your type) and returns a string of option tags. Given a container

0 comments on commit 130c493

Please sign in to comment.
Something went wrong with that request. Please try again.