Module | VestalVersions::Versions |
In: |
lib/vestal_versions/versions.rb
|
An extension module for the has_many association with versions.
Returns all version records created after the version associated with the given value.
This is useful for dissociating records during use of the +reset_to!+ method.
Returns a single version associated with the given value. The following formats are valid:
Returns all version records created before the version associated with the given value.
Returns all versions between (and including) the two given arguments. See documentation for the at extension method for what arguments are valid. If either of the given arguments is invalid, an empty array is returned.
The between method preserves returns an array of version records, preserving the order given by the arguments. If the from value represents a version before that of the to value, the array will be ordered from earliest to latest. The reverse is also true.
Returns the version number associated with the given value. In many cases, this involves simply passing the value to the at method and then returning the subsequent version number. Hoever, for Numeric values, the version number can be returned directly and for Date/Time values, a default value of 1 is given to ensure that times prior to the first version still return a valid version number (useful for reversion).