1
0
Fork 0
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:
Eric Schwartz 2012-01-23 15:05:00 -07:00 committed by Angelo Lakra & Jason Noble
parent a6c5e52902
commit a14cea6376

View file

@ -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",