In October I worked on a patch for a long-requested feature:
associations that can go :through anything, including other :through
associations.
The Lighthouse ticket is here:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1152
I believe this is a robust, well-tested patch. I want to get it merged,
but there has been very little response to the patch on Lighthouse. I
should probably have posted on here before now - but here I am now
anyway.
Can anyone help verify/review this patch? Any suggestions about how best
to get it accepted by the core team?
Also, can somebody with the relevant permissions changes the status from
"incomplete" to "open" please? I am actively maintaining the branch and
merging in the latest master from time to time. I will also happily deal
with any issues which arise as a result of this patch.
Thanks,
Jon Leighton
Jose has responded on the pull request:
===========================================
Hey mate, thanks for the pull request. But could you please send this
request to Rails mailing list and get feedback from more people?
At first, I am -1 on this feature. Rails has_many :through, without
being nested, already have a few limitations that I really would like to
see fixed before adding more complexity. For example, in the case "User
has many groups through subscriptions", the following does not work:
group = user.groups.build
group.save
As it does not save the associated object subscriptions.
Calling .create() works as expected though. The lack of the ability to
support a dependent option (like :destroy, :delete) for the associated
record is also another limitation (currently we have dangling records).
We can find others examples in LH.
===========================================
I wanted to respond here to prevent the discussion being split over
multiple places:
I see the concern. Though we should be clear that nested through
associations will only ever be read-only, as writing to them would not
make any sense (not enough information to determine correct join
records).
What I would propose is that I do an audit of tickets on LH that are
related to has many through. I suspect some of them will be solved by my
patch (as it rewrites lots of HMT code). I could identify others which
are still an issue. Then maybe we could identify which other tickets
should be fixed before this nested patch goes in. I'm happy to look at
other tickets as a stepping stone to getting this patch in.
However it would be good if people could be up front and say now if
there are general concerns with this patch in principle, or whether
concerns are just around not introducing more bugs in HMT given the
number of existing bugs.
Hope that makes sense.
Cheers,
Jon
I'm very much in favor of hmt working to an infinite depth. From my own experience as well as responding to others, I know it's something that people just expect to work.
I'm also concerned about bugs, but I like your suggestion Jon.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.