diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-03-13 13:14:55 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2015-04-08 13:31:28 -0400 |
commit | 89713897830cabe49658755ddd673bbdb0a64f11 (patch) | |
tree | 2239cd3e0ccf380ea7117ad2458a75845acface2 /activerecord/lib/active_record/persistence.rb | |
parent | 67c2deeb4be58f9f4c24f32400d41bdd355021f9 (diff) | |
download | rails-89713897830cabe49658755ddd673bbdb0a64f11.tar.gz rails-89713897830cabe49658755ddd673bbdb0a64f11.tar.bz2 rails-89713897830cabe49658755ddd673bbdb0a64f11.zip |
Batch touch parent records
[fixes #18606]
Make belongs_to use touch over touch_later when running the callbacks.
Add more tests and small method rename
Thanks Jeremy for the feedback.
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index a6176dffdb..a1e1073792 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -462,9 +462,10 @@ module ActiveRecord # ball = Ball.new # ball.touch(:updated_at) # => raises ActiveRecordError # - def touch(*names, time: current_time_from_proper_timezone) + def touch(*names, time: nil) raise ActiveRecordError, "cannot touch on a new record object" unless persisted? + time ||= current_time_from_proper_timezone attributes = timestamp_attributes_for_update_in_model attributes.concat(names) |