You should only be using sequel 2.8.0. It's been a while since
jeremyevans merged sequel-core and sequel-model. (http://github.com/
jeremyevans/sequel/commit/778a032ea68193cf4c981a3177f06159fa5a1921)

2) I believe it should create and save the join record but I can't be
of any more help.

On Jan 3, 1:22 pm, "Rue the Ghetto" <[email protected]> wrote:
> Hi exploid,
> Thanks for responding with that link, and with haste. It was more
> information than I found on non-advanced relationships, but hasn't really
> answered my questions, particularly the second.
>
> I guess my first question is changing too. The example implies that you can
> add an unsaved object to a many_to_one association, and that it will be
> saved when the parent object is saved. I am using sequel 2.8.0, with
> sequel-model 0.5.0.2, and getting an error stating that the record doesn't
> have a primary key when I try to add an unsaved record. So, any hints about
> what I am doing wrong.
>
> Also, adding an unsaved record to a one_to_many association works without
> fail. But when I save the parent record. The records in the association
> don't save with it. They are still new records. Is that expected behavior?
>
> And of course my question #2 from before stands: when adding a record to a
> many_to_many association, is the join record supposed to be created ...
> because it isn't happening for me.
>
> Thanks!
>
> On Sat, Jan 3, 2009 at 8:05 AM, exploid <[email protected]> wrote:
>
> > Hello ru_ghetto,
>
> > Welcome to Sequel! I hope you are satisfied with what you've seen so
> > far.
>
> > I believe what you are looking for can be found here
> >http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/Associations.html.
>
> > exploid
>
> > On Jan 3, 3:27 am, ru_ghetto <[email protected]> wrote:
> > > Hi
>
> > > I just started looking into Sequel, am starting a little project with
> > > it and had some questions. Specifically I am wondering about adding
> > > records to established model associations:
>
> > > 1) Is there anyway to add new records to an association? Using the
> > > hackneyed blog metaphor, we could have a Post model with
> > >       many_to_one :author
> > > Could you add an author object via Post.first.author = Author.new
> > > ( pararms ... )
> > > I haven't seen anything in documentation that indicates this is
> > > possible. I have done some experimenting and looked in the specs too.
>
> > > 2) With many_to_many relationships using a specified join_table,
> > > should a call like ... Post.first.comments << Comment.create
> > > ( params ...) also create a record in the join table. It isn't yet
> > > working out that way for me and my Sequel experiments. I know it is
> > > possible to add private methods related to the associations for adding
> > > and destroying records, but I wasn't sure if that should already be
> > > happening with a many_to_many with a join_table.
>
> > > Thanks in advance for the information
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to