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
1 changed files with 4 additions and 0 deletions

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