mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Adding a between scope to Version to see if any changes happened during a period
This commit is contained in:
parent
a6c5e52902
commit
a14cea6376
1 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,10 @@ class Version < ActiveRecord::Base
|
|||
where(['created_at > ?', timestamp]).order("created_at ASC, #{self.primary_key} ASC")
|
||||
}
|
||||
|
||||
scope :between, lambda { |start_time, end_time|
|
||||
where(['created_at > ? AND created_at < ?', start_time, end_time ]).order("created_at ASC, #{self.primary_key} ASC")
|
||||
}
|
||||
|
||||
# Restore the item from this version.
|
||||
#
|
||||
# This will automatically restore all :has_one associations as they were "at the time",
|
||||
|
|
Loading…
Reference in a new issue