I do have the explicit model. So I have to also explicitly create the join record as well, if I understand correctly. Yes?
Thanks a lot for the info! :) On Dec 4, 7:14 am, Jonathan Stott <[email protected]> wrote: > No, that's the right way to do it. > > You need to have an explicit join model, not Resource. Then you just create > it like a normal model as per your example. > > Regards > Jon > On 3 Dec 2010 23:56, "kasthor" <[email protected]> wrote: > > > > > > > > > to have that you need something like > > > has n, :person_places > > has n, :people, :through => :person_places > > > up to this point i think we're clear, u've already done that > > > but based on that, what i do at the moment is > > > PersonPlace.create( :person => person, :place => place, :created_by => > > current_user ) > > > up to this point that's the solution i've found, i would gladly accept > > any other recommendation > > > On Dec 3, 3:44 pm, dev2 <[email protected]> wrote: > >> Before a record is saved I need to set a required property. This > >> doesn't seem to work using the before :save hook. > > >> Its actually a property in a join model. > > >> Person > >> Place > >> PersonPlace > > >> In PersonPlace there is a field that needs to have the id of the user > >> that created it. > > >> Normally I would save the record with the following method: > > >> person = Person.create({....}) > >> place = Place.create({....}) > > >> place.people << person > > >> however this doesn't allow me to add an additional property to the > >> join table. > > >> Any ideas or recommendations? > > >> Thanks! > > > -- > > 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]<datamapper%2bunsubscr...@googlegrou > ps.com> > .> For more options, visit this group at > > http://groups.google.com/group/datamapper?hl=en. > > > > > > > > -- 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.
