From 999c9fe364391532a09a525126650845180e83cf Mon Sep 17 00:00:00 2001 From: Kiran Chaudhari Date: Mon, 5 May 2014 16:41:09 +0530 Subject: [PATCH] Fix supported rails4 - replace query in events_for_date_range --- lib/event_calendar.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/event_calendar.rb b/lib/event_calendar.rb index d4fe85c..5db1de6 100644 --- a/lib/event_calendar.rb +++ b/lib/event_calendar.rb @@ -49,11 +49,7 @@ def get_start_and_end_dates(shown_date, first_day_of_week=0) # Get the events overlapping the given start and end dates def events_for_date_range(start_d, end_d, find_options = {}) - self.scoped(find_options).find( - :all, - :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 ], - :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC" - ) + self.where("(? <= #{self.end_at_field}) AND (#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ).order("#{self.start_at_field} ASC") end # Create the various strips that show events. @@ -188,4 +184,4 @@ def adjust_all_day_dates end end -require 'event_calendar/railtie' if defined?(::Rails::Railtie) \ No newline at end of file +require 'event_calendar/railtie' if defined?(::Rails::Railtie)