I have a couple of related questions...
What is the merb way to provide forms with fields for multiple
instances of the same model? Rails has the bracket notation and also
the ':index' attribute on input fields, but I'm not having any success
making those work in merb.
The kind of situation I'm looking at is where I have an event
registration form that includes address information for two different
individuals who are part of the registration. Something like this...
form_for @registration do
fields_for @registration.first_person.address do
text_field :street_address
end
fields_for @registration.second_person.address do
text_field :street_address
end
end
So from this I get two sets of POST parameters 'address
[street_address]' , and the second overwrites the first. Obviously not
what I'm aiming for. I've tried a few things but haven't found
anything yet that works.
The second question (perhaps a datamapper question) arises in the same
context...
The Registration model belongs to both the first_person and the
second_person, and both are instances of the User class. So in my
Registration class I tried something like -
class Registration
belongs_to :first_person, :class_name => User
belongs_to :second_person, :class_name => User
end
The problem of course is that I end up with two foreign keys with the
identical name: 'user_id'. What's the right way to deal with this kind
of situation? I tried a ':foreign_key' option, which apparently works
in Rails, but that doesn't seem to help here.
Appreciate any advice.
Mark.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---