I''m trying to generate a form that uses has_many :through and multiple
selects. I''m working directly with the join table controller and
working with edge rails. I want to generate a list to populate the
join table without doing one step over and over again. When items are
successfully created they contain the wrong information (Only a single
entry and 1 for both join id values. Here''s the code:
<p><label for="connection_familytype">Applicable
Units</label><br/>
<select name="connection[familytype_id][]"
id="connection_familytype_ids" multiple="multiple">
<option value="0">All</option>
<%option_groups_from_collection_for_select(Familytype.find(:all, :order
=> "name", :conditions => "parent_id IS NULL and name !=
''all''"),
"children.find(:all)",
"name", "id", "name")%>
<br/><br/></select>
</p>
<% collection_multiple_select(
''connection'', ''producttest_id'',
Producttest.find(:all, :order =>
"name", :conditions => "parent_id > 0"), :id, :name
)
%>
######################################
and the dump:
undefined method `producttest_ids='' for #<Connection id: nil,
familytype_id: 1, producttest_id: 1>
vendor/rails/activerecord/lib/active_record/base.rb:2028:in
`method_missing''
app/controllers/connection_controller.rb:30:in `create''
-e:4:in `load''
-e:4
Request
Parameters:
{"commit"=>"Create",
"connection"=>{"producttest_id"=>["3",
"13",
"14"],
"familytype_id"=>["10015",
"7",
"5",
"9"]}}
######################################
I would like to see the following generated from the above
Join table:
3 10015
3 7
3 5
3 9
13 10015
...
14 5
14 9
######################################
Response
Headers:
{"cookie"=>[],
"Cache-Control"=>"no-cache"}
######################################
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---