This project is archived and is in readonly mode.

#4392 ✓wontfix
Diego Carrion

[PATCH] Add :touch option to has_one associations

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

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.

Comments and changes to this ticket

  • Diego Carrion
  • Diego Carrion

    Diego Carrion April 14th, 2010 @ 07:28 AM

    • Tag set to activerecord, has_many, rails, touch
  • Diego Carrion

    Diego Carrion April 14th, 2010 @ 07:35 PM

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

    Diego Carrion April 15th, 2010 @ 03:24 PM

    • Assigned user set to “Ryan Bigg”
  • Ryan Bigg

    Ryan Bigg April 15th, 2010 @ 03:26 PM

    • Assigned user cleared.

    I am not responsible for applying patches, sorry.

  • Diego Carrion

    Diego Carrion April 18th, 2010 @ 12:46 AM

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

    Diego Carrion April 19th, 2010 @ 01:43 AM

    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.

  • Diego Carrion

    Diego Carrion April 19th, 2010 @ 01:44 AM

    • 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.

  • Diego Carrion

    Diego Carrion April 19th, 2010 @ 01:44 AM

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

    Diego Carrion April 19th, 2010 @ 01:50 AM

    • 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.

  • Michael Koziarski

    Michael Koziarski April 19th, 2010 @ 10:00 PM

    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.

  • Michael Koziarski

    Michael Koziarski April 19th, 2010 @ 10:00 PM

    • 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.

  • Diego Carrion

    Diego Carrion April 20th, 2010 @ 01:14 AM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages