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.

[PATCH] Add :touch option to has_one associations

#4392

Hi, I have a model with some children that should be updated when the parent change, it would be nice to have this feature in Rails.

Reported by Diego Carrion · April 14th, 2010 @ 07:19 AM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Diego Carrion
  2. Diego Carrion
    Diego Carrion
    • Tag set to activerecord, has_many, rails, touch

    April 14th, 2010 @ 07:28 AM

  3. Diego Carrion
    Diego Carrion
    • Title changed from Add :touch option to has_many associations to [PATCH] Add :touch option to has_many associations

    April 14th, 2010 @ 07:35 PM

  4. Diego Carrion
    Diego Carrion
    • Assigned user set to Ryan Bigg

    April 15th, 2010 @ 03:24 PM

  5. Ryan Bigg
    Ryan Bigg
    • Assigned user cleared.

    I am not responsible for applying patches, sorry.

    April 15th, 2010 @ 03:26 PM

  6. Diego Carrion
    Diego Carrion
    • Tag changed from activerecord, has_many, rails, touch to activerecord, has_many, patch, rails, touch

    April 18th, 2010 @ 12:46 AM

  7. Diego Carrion
    Diego Carrion

    Some people on the list gave me some feedback and because of that I added also the touch support for has_one associations.

    A new patch is attached.

    April 19th, 2010 @ 01:43 AM

  8. Diego Carrion
    Diego Carrion
    • Tag changed from activerecord, has_many, patch, rails, touch to activerecord, has_many, has_one, patch, rails, touch

    Some people on the list gave me some feedback and because of that I added also the touch support for has_one associations.

    A new patch is attached.

    April 19th, 2010 @ 01:44 AM

  9. Diego Carrion
    Diego Carrion
    • Title changed from [PATCH] Add :touch option to has_many associations to [PATCH] Add :touch option to has_many and has_one associations

    April 19th, 2010 @ 01:44 AM

  10. Diego Carrion
    Diego Carrion
    • Title changed from [PATCH] Add :touch option to has_many and has_one associations to [PATCH] Add :touch option to has_many associations

    Sorry, I forgot the RDoc documenation in the previous patch, added a new one.

    April 19th, 2010 @ 01:50 AM

  11. Michael Koziarski
    Michael Koziarski

    As discussed on the mailing list, I don't believe that the feature is justified for the sake of consistency alone. It would hide severe performance issues inside a simple declaration.

    People needing this functionality can write a tiny after_save themselves.

    April 19th, 2010 @ 10:00 PM

  12. Michael Koziarski
    Michael Koziarski
    • State changed from new to wontfix

    As discussed on the mailing list, I don't believe that the feature is justified for the sake of consistency alone. It would hide severe performance issues inside a simple declaration.

    People needing this functionality can write a tiny after_save themselves.

    April 19th, 2010 @ 10:00 PM

  13. Diego Carrion
    Diego Carrion
    • Title changed from [PATCH] Add :touch option to has_many associations to [PATCH] Add :touch option to has_one associations

    As discussed with Michael via the mailing list, the touch option for the has_one association does make sense so Im sending a patch.

    I added also a test covering the scenario where the associated object doesn't exists, given that the validation was in the code but after deleting it, nothing broke.

    April 20th, 2010 @ 01:14 AM