David Kahn
2011-May-18  17:13 UTC
Is it possible to populate a join table in a HABTM relationship via nested forms (accepts attributes for)?
High level, if I have the following two models with a join table, is it
possible to create a nested form which would populate the join table. In
this case, I would have a form for Roster with multiple nested forms for
players_rosters (the join table). From what I see in playing with this and
online is that it is not possible, and probably is a design issue, maybe
better to make player_rosters a model that way I could get at it directly
(and more easily on my nested form). Any feedback?
  create_table "rosters", :force => true do |t|
    t.string   "name"
    t.integer  "fantasy_matchup_id"
  end
  create_table "players", :force => true do |t|
    t.string   "first_name"
    t.string   "last_name"
  end
  create_table "players_rosters", :id => false, :force => true
do |t|
    t.integer "player_id"
    t.integer "roster_id"
  end
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.