4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/minty_scopes/timestamps.rb', line 4
def self.extended(within)
within.class_eval do
named_scope :created_on, lambda { |date|
raise "The 'created_on' named_scope expects a Date, Time or DateTime object" unless date.respond_to? :end_of_day
{ :conditions => {:created_at => (date.beginning_of_day..date.end_of_day)} }
}
named_scope :modified_on, lambda { |date|
raise "The 'modified_on' named_scope expects a Date, Time or DateTime object" unless date.respond_to? :end_of_day
{ :conditions => {:modified_on => (date.beginning_of_day..date.end_of_day)} }
}
end
end
|