On Sat, Mar 7, 2009 at 4:09 AM, Lighthouse <no-
[email protected]> wrote:
> HasOneThroughAssociation inheriting from HasManyThroughAssociation seems 
> logical to me. What are the
> advantages of this patch ? If there's some bug to be fixed by doing this, I'd 
> happily apply. Otherwise, let's just
> wait till this refactoring is actually needed.

To put not too fine a point on it, this is a fundamentally improper
use of inheritance; the relationship exists to share implementation
rather than interface.  Ruby provides modules for this exact
situation.  Pulling the shared functionality into a shared module is
straightforward, and simplifies the code by removing special case
interface overrides.

This inheritance relationship has already caused its share of bugs, as
mentioned by commenters on the ticket.  I fixed two here:
http://rails.lighthouseapp.com/projects/8994/tickets/895-has_one-through-errors.
More importantly, the added complexity created by importing all of the
collection logic and interface into a non-collection association class
just adds to rigidity and potential for odd bugs in the future.

What concerns me most about this is that resistance to cleaning up
code likely implies a lack of confidence in the test suite.
Considering how core associations are to Rails, and the not
insignificant amount of cruft in that code, there should be tests on
associations like fat kids on an ice cream truck.  What are you
concerned the changes will break, given that all the tests pass?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to