This project is archived and is in readonly mode.
Touch does not propagate anymore
Reported by Jakub Kuźma | August 2nd, 2010 @ 08:36 AM | in 3.0.2
Since touch method has changed significantly, there no possibility to do something like this anymore:
class FirstModel < ActiveRecord::Base
end
class SecondModel < ActiveRecord::Base
belongs_to :first_model, :touch => true
end
class ThirdModel < ActiveRecord::Base
belongs_to :second_model, :touch => true
end
m = ThirdModel.first
m.touch # updates m record only, doesn't execute callbacks
m.attributes = { ... }
m.save! # updates m and m.second_model only
I think it was a really useful feature - I used it for caching or versioning several times. Is there any reason (apart from higher performance) to do it using update_attribute instead of saving the model?
Comments and changes to this ticket
-
José Valim August 2nd, 2010 @ 09:23 AM
- Milestone cleared.
- State changed from new to open
- Assigned user set to José Valim
- Importance changed from to Low
-
Jakub Kuźma August 2nd, 2010 @ 10:11 AM
Added failing test.
The code raises:
SQLite3::SQLException: near "WHERE": syntax error: UPDATE "toys" SET WHERE ("toys"."toy_id" = 1)... cause there's no timestamp in toys table. In my opinion the code should be correct, and change the timestamp in Owner record.
-
Repository August 2nd, 2010 @ 03:19 PM
- State changed from open to resolved
(from [b613c3cc7b08b00595e33d1b5302cd5d42687d4e]) Add an internal (private API) after_touch callback. [#5271 state:resolved] http://github.com/rails/rails/commit/b613c3cc7b08b00595e33d1b5302cd...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 5271 Touch does not propagate anymore (from [b613c3cc7b08b00595e33d1b5302cd5d42687d4e]) Add an ...