Skip to content

Commit

Permalink
match AR::Base#touch behavior more closely.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed May 1, 2016
1 parent c541a37 commit ca3f978
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/acts_as_list/active_record/acts/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,15 @@ def self.increment_all_with_touch
end
def self.update_all_with_touch(updates)
attrs = new.send(:timestamp_attributes_for_update_in_model)
record = new
attrs = record.send(:timestamp_attributes_for_update_in_model)
now = record.send(:current_time_from_proper_timezone)
query = attrs.map { |attr| "\#{attr} = :now" }
query.push updates
query = query.join(", ")
update_all([query, now: Time.now.utc])
update_all([query, now: now])
end
EOV

Expand Down

0 comments on commit ca3f978

Please sign in to comment.