From d4a784a43888b0bb7f863a642bc787071ad19eea Mon Sep 17 00:00:00 2001 From: Don Vanboom Date: Fri, 12 Sep 2014 09:27:02 -0500 Subject: [PATCH] removed deprecated scoped and find(:all) for rails 4 --- lib/event_calendar.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/event_calendar.rb b/lib/event_calendar.rb index d4fe85c..a6f3f31 100644 --- a/lib/event_calendar.rb +++ b/lib/event_calendar.rb @@ -49,10 +49,9 @@ 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(find_options).where( + "(? <= #{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" ) end @@ -188,4 +187,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)