diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-22 01:32:40 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-22 01:32:40 +0000 |
commit | 130c493a4ff295723fa08935c71b89badef06cdc (patch) | |
tree | 7f091019736e9e259d25319e2c4323e7792ff544 /actionpack/lib/action_view/helpers | |
parent | d21ba5aec9f5c5ddd00f478cd55930daef029c9d (diff) | |
download | rails-130c493a4ff295723fa08935c71b89badef06cdc.tar.gz rails-130c493a4ff295723fa08935c71b89badef06cdc.tar.bz2 rails-130c493a4ff295723fa08935c71b89badef06cdc.zip |
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
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index b96d7a8f02..418b000163 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -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 diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index e40249432a..9e30e0fd7d 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -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 |