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:
parent
09e56e6616
commit
acdfa79473
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue