Class: VestalVersions::Version
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- VestalVersions::Version
- Includes:
- Comparable
- Defined in:
- lib/vestal_versions/version.rb
Overview
The ActiveRecord model representing versions.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
In conjunction with the included Comparable module, allows comparison of version records based on their corresponding version numbers, creation timestamps and IDs.
-
#initial? ⇒ Boolean
Returns whether the version has a version number of 1.
Instance Method Details
#<=>(other) ⇒ Object
In conjunction with the included Comparable module, allows comparison of version records based on their corresponding version numbers, creation timestamps and IDs.
18 19 20 |
# File 'lib/vestal_versions/version.rb', line 18 def <=>(other) [number, created_at, id].map(&:to_i) <=> [other.number, other.created_at, other.id].map(&:to_i) end |
#initial? ⇒ Boolean
Returns whether the version has a version number of 1. Useful when deciding whether to ignore the version during reversion, as initial versions have no serialized changes attached. Helps maintain backwards compatibility.
25 26 27 |
# File 'lib/vestal_versions/version.rb', line 25 def initial? number == 1 end |