Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4837: form_options_helper_doc_patch.txt

File form_options_helper_doc_patch.txt, 1.1 kB (added by srjoseph@hawaii.edu, 2 years ago)

doc patch

Line 
1 Index: D:/User/Code/ruby/actionpack/lib/action_view/helpers/form_options_helper.rb
2 ===================================================================
3 --- D:/User/Code/ruby/actionpack/lib/action_view/helpers/form_options_helper.rb (revision 3425)
4 +++ D:/User/Code/ruby/actionpack/lib/action_view/helpers/form_options_helper.rb (working copy)
5 @@ -67,6 +67,12 @@
6        end
7  
8        # Return select and option tags for the given object and method using options_from_collection_for_select to generate the list of option tags.
9 +      #
10 +      # Want to display and update habtm relations with multiple selection?  Modify the following example:
11 +      #
12 +      # collection_select(:user, :group_ids, Group.find(:all), :id, :name,{},{:multiple=>'',:name=>'user[group_ids][]'})
13 +      #
14 +      # this works where users and groups are in a habtm relation
15        def collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})
16          InstanceTag.new(object, method, self, nil, options.delete(:object)).to_collection_select_tag(collection, value_method, text_method, options, html_options)
17        end