> Any help, ideas, discussions on irc/email, forks, patches, whatever
> ... are really appreciated!

This time to the mailing list (and to the right mailing list!)

OKay ....played some more - not sure if this is in nested attributes
territory or not but here's my setup:

class Team
  has n,    :team_memberships,      :class_name   => "TeamMember"
  has n,    :team_members,          :through      => :team_memberships,
                                    :class_name   => "User",
                                    :child_key    => [:team_id],
                                    :remote_name  => :user,

  accepts_nested_attributes_for :team_memberships
end

class TeamMember
  belongs_to    :team
  belongs_to    :user
end

class User
  has n,    :team_memberships,      :class_name => "TeamMember"
end

Then on a form for creating a team I have dropdowns for selecting the
team member names which result in the following attributes being sent
back to the Team model:

Team.new({"name"=>"adds",
          "team_memberships_attributes"=>[{"user_id"=>"5"}, {"user_id"=>"42"}],
          "short_name"=>""}
)

Now if the validation fails on the team model (cause the short_name
has been left blank) then I can't see how to recover the selections
made for the team memberships so that when the form is re-displayed
with errors it looks like it did when it was submitted.

Any thoughts???

Cheers

Rupert

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to