diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-13 11:13:11 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-13 11:13:11 +0000 |
commit | 947cec29d5f074682052e8412904cc88a914fdbc (patch) | |
tree | 2888aa13f47984175aba6f83bacf6e925b5d5a60 /actionpack/lib/action_view/helpers/form_options_helper.rb | |
parent | 4a5b042fc7805f95b4a096cafe0d57e105246095 (diff) | |
download | rails-947cec29d5f074682052e8412904cc88a914fdbc.tar.gz rails-947cec29d5f074682052e8412904cc88a914fdbc.tar.bz2 rails-947cec29d5f074682052e8412904cc88a914fdbc.zip |
Added FormHelper#form_for and FormHelper#fields_for that makes it easier to work with forms for single objects also if they don't reside in instance variables [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_options_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index a529b71e31..100d3ac8d3 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -335,5 +335,23 @@ module ActionView end end end + + class FormBuilder + def select(method, choices, options = {}, html_options = {}) + @template.select(@object_name, method, choices, options.merge(:object => @object), html_options) + end + + def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) + @template.collection_select(@object_name, method, collection, value_method, text_method, options.merge(:object => @object), html_options) + end + + def country_select(method, priority_countries = nil, options = {}, html_options = {}) + @template.country_select(@object_name, method, priority_countries, options.merge(:object => @object), html_options) + end + + def time_zone_select(method, priority_zones = nil, options = {}, html_options = {}) + @template.time_zone_select(@object_name, method, priority_zones, options.merge(:object => @object), html_options) + end + end end end |