On Oct 18, 8:25 am, Nate Wiger <[email protected]> wrote:
> Great - completely agree the association should be checked.  Looks
> like that's broken in the existing API when you pass a full object
> though.  You can actually null out an arbitrary object:
>
> http://pastie.org/659500
>
> The change you made will definitely catch it in the case where I pass
> an ID, but we should ensure the common case too I think.  Something
> like this:
>
> http://pastie.org/659524.txt
>
> Sticking with the Sequel strictness goal (which I love) I made it an
> exception.
>
> I'm sure there's a way to do it w/o a DB call, but I'm still learning
> the internals.

I like your idea, and took it a step further: http://pastie.org/659666.txt.
I still used a DB call, since I think that is more reliable.

However, I'm pretty sure that breaks remove_ for many_to_many
associations.  We can probably just remove the check for the object
already being associated in the many_to_many case, since that won't
negatively affect things.

We should also add all relevant specs that we added for one_to_many
associations for many_to_many associations as well.  While they
currently call the same internal methods, they should have separate
specs.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
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