On Nov 19, 9:41 am, "Dirkjan Bussink" <[EMAIL PROTECTED]> wrote:
> >        crappy = Tagging.new
> >        post.taggings << crappy
> >        post.save
>
> This saving will always be required, because adding a new object to an
> association should never have the side effect of actually saving the
> Tagging object here too. That would be really unexpected imho.
>
> For us, ActiveRecord is not the default standard on how things behave.
> We like to create something that fits the Ruby idiom of behaving like
> a developer expects. Saving objects as a side-effect of just adding it
> to an association does not really fit that principle of least
> surprise.
>
> These things notwithstanding, the has :through code is not up to par,
> so there probably will be issues. We're not yet sure on how to solve
> all of these problems, so that will take some discussion too.
>
> --
> Regards,
>
> Dirkjan Bussink


I guess least surprise is in the eye of the beholder. My $0.02 is that
if I declare that model Post:

has n, :tags, :through :taggings

I have plainly stated an intention that the only way an object of
class Tag can be associated with one of class Post is by creating an
instance of a join model Tagging. So if I then say

post.tags << some_tag

(if in fact you are going to allow that) imo there is no way to
interpret this as meaning something other than an intention to create
a join model instance. Making me explicitly create the join instance
and associate it separately in each direction seems like unnecessary
repetition to me. Also, I assume (though haven't tested) that if I use
the form :through => Resource, the (in this case) anonymous join model
does actually get created and saved automatically when I do an
association across the :through relationship. Is this true?

Without providing this behavior, I don't really see why datamapper
would bother offering the :through option. Am I missing something?

Mark.
--~--~---------~--~----~------------~-------~--~----~
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