rails3: fix override timestamps

Change-Id: I5647ecdad8023dad1d5e463c6dbb8e2e1b927d33
Reviewed-on: https://gerrit.instructure.com/30856
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
This commit is contained in:
Cameron Matheson 2014-02-25 16:31:34 -07:00
parent 7b3a489ffc
commit 8a1aea0c39
1 changed files with 5 additions and 4 deletions

View File

@ -154,10 +154,11 @@ module AssignmentOverrideApplicator
def self.setup_overridden_clone(assignment, overrides = [])
clone = assignment.clone
# ActiveRecord::Base#clone nils out the primary key; put it back
clone.id = assignment.id
self.copy_preloaded_associations_to_clone(assignment,
clone)
# ActiveRecord::Base#clone wipes out some important crap; put it back
[:id, :updated_at, :created_at].each { |attr|
clone[attr] = assignment.send(attr)
}
self.copy_preloaded_associations_to_clone(assignment, clone)
yield(clone) if block_given?
clone.applied_overrides = overrides