Module: PaperTrail::ActiveRecordExt::VersionConcernExt::ClassMethods
- Defined in:
- lib/paper_trail/active_record/version_extensions.rb
Instance Method Summary collapse
-
#between_inclusive(start_time, end_time) ⇒ Object
Same as between but uses gteq/lteq instead of gt/lt.
-
#preceding_inclusive(obj, timestamp_arg = false) ⇒ Object
Returns versions before
obj
.
Instance Method Details
#between_inclusive(start_time, end_time) ⇒ Object
Same as between but uses gteq/lteq instead of gt/lt
27 28 29 30 31 32 |
# File 'lib/paper_trail/active_record/version_extensions.rb', line 27 def between_inclusive(start_time, end_time) where( arel_table[:created_at].gteq(start_time). and(arel_table[:created_at].lteq(end_time)) ).order() end |
#preceding_inclusive(obj, timestamp_arg = false) ⇒ Object
Returns versions before obj
.
Same as preceding but uses lteq instead of lt
16 17 18 19 20 21 22 23 24 |
# File 'lib/paper_trail/active_record/version_extensions.rb', line 16 def preceding_inclusive(obj, = false) if != true && primary_key_is_int? return where(arel_table[primary_key].lteq(obj.id)).order(arel_table[primary_key].desc) end obj = obj.send(:created_at) if obj.is_a?(self) where(arel_table[:created_at].lteq(obj)). order(("desc")) end |