all implied, you do not need it when using areas.
50
51 def events_for_date_range(start_d, end_d, find_options = {})
52 self.where(find_options,
53 :conditions => [ "(? <= #{self.quoted_table_name}.#{self.end_at_field}) AND (#{self.quoted_table_name}.#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ],
54 :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC"
55 )
56 end
You would use only allif you really want all the records: CustomEvent.all. If you are worried about default scales, you can do something like this:
50
51 def events_for_date_range(start_d, end_d, find_options = {})
52 self.unscoped.where(find_options,
53 :conditions => [ "(? <= #{self.quoted_table_name}.#{self.end_at_field}) AND (#{self.quoted_table_name}.#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ],
54 :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC"
55 )
56 end
all rails 4 , load:
50
51 def events_for_date_range(start_d, end_d, find_options = {})
52 self.where(find_options,
53 :conditions => [ "(? <= #{self.quoted_table_name}.#{self.end_at_field}) AND (#{self.quoted_table_name}.#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ],
54 :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC"
55 ).load
56 end