Update PaperTrail::Model#version_at to pass-thru options to reify.

This allows versioned_instance.version_at(timestamp, :has_one => false).
This commit is contained in:
Emmanuel Gomez 2011-02-16 14:32:46 -08:00 committed by Andy Stewart
parent 09e56e6616
commit acdfa79473
1 changed files with 2 additions and 2 deletions

View File

@ -68,11 +68,11 @@ module PaperTrail
end end
# Returns the object (not a Version) as it was at the given timestamp. # Returns the object (not a Version) as it was at the given timestamp.
def version_at(timestamp) def version_at(timestamp, reify_options={})
# Because a version stores how its object looked *before* the change, # Because a version stores how its object looked *before* the change,
# we need to look for the first version created *after* the timestamp. # we need to look for the first version created *after* the timestamp.
version = versions.after(timestamp).first version = versions.after(timestamp).first
version ? version.reify : self version ? version.reify(reify_options) : self
end end
# Returns the object (not a Version) as it was most recently. # Returns the object (not a Version) as it was most recently.