Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Backport :inverse_of from 3.0 to 2.3.x

#3533

Speaking to Eloy Durán on IRC it turned out that some other issues raised against 2.3.x would be solved more easily if the :inverse_of functionality was available.

The attached diff is simply the 3 commits to edge that implemented :inverse_of correctly merged onto 2-3-stable. They didn't apply cleanly and there were some conflicts that need resolving.

It should run a green test suite.

Reported by Murray Steele · December 1st, 2009 @ 09:14 PM

State: resolved
Milestone: 2.3.6
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Murray Steele
    Murray Steele

    Also, note that George Ogata has a couple of other tickets ([1], [2]) about improving the inverse_of functionality. We should probably apply them to edge and 2-3-stable as well.

    [1] https://rails.lighthouseapp.com/projects/8994/tickets/3520-add-inve... [2] https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...

    December 1st, 2009 @ 09:21 PM

  2. Murray Steele
  3. George Ogata
    George Ogata

    Tested both my patches on top of Murray's patch on 2-3-stable. The whole stack applies cleanly and the tests pass. It's also quite a simple modification to ActiveRecord all up.

    Not sure what the above mentioned issues are that would be aided by inverse associations, but I'm keen to see this functionality in sometime soon. Until then, I have a plugin which backports it for 2.x apps to use right now, for anyone that's interested.

    December 2nd, 2009 @ 06:26 AM

  4. Eloy Duran
    Eloy Duran
    • Assigned user changed from Eloy Duran to Michael Koziarski
    • Milestone set to 2.3.6

    Thanks for the work Murphy! The most heard ‘issue’ is that people that use NestedAttributes can’t validate the presence of the parent. Also in multiple cases I really wanted to have access to the parent during building an associated record.

    I’ve applied the patch, plus a patch from master that adds tests for the aforementioned validation problem.

    http://github.com/Fingertips/rails/commits/2-3-stable

    I’ve also checked George's patches, they indeed apply and the tests run. But I'd like to know if anyone else has been using these patches on a real app before I push them? Besides George that is ;)

    All in all, since 2.3.5 has recently been released, I think it would be best that if this will be applied to 2.3.x we do it asap. So people have time to actually test it a while before 2.3.6 is released.

    December 2nd, 2009 @ 07:37 PM

  5. George Ogata
    George Ogata

    I think it's safe to say my patches haven't been used much by others yet. I only wrote them recently.

    That said, one is just a one-line bug fix. The polymorphic support is a little more involved - your call. I agree sooner would be better, though, for the reason you cited.

    December 4th, 2009 @ 06:57 AM

  6. Murray Steele
    Murray Steele

    Updated the patch to also include the patch committed to master that resolves [2815].

    December 17th, 2009 @ 10:04 AM

  7. Murray Steele
  8. Murray Steele
    Murray Steele

    Just reminding myself that when #3513 and/or #3520 are applied to master, we should revisit this patch to backport them to 2-3-stable if this patch hasn't already been committed.

    December 17th, 2009 @ 12:34 PM

  9. Eloy Duran
    Eloy Duran
    • State changed from new to resolved

    December 28th, 2009 @ 08:49 PM