FormHelper correctly passes its object through select, collection_select, country_select, and time_zone_select.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3156 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2005-11-22 01:32:40 +00:00
parent d21ba5aec9
commit 130c493a4f
2 changed files with 7 additions and 5 deletions

View File

@@ -317,7 +317,9 @@ module ActionView
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 File

@@ -60,17 +60,17 @@ module ActionView
# 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 @@ module ActionView
# 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