Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated .scoped and find(:all) for rails 4 #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/event_calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -188,4 +187,4 @@ def adjust_all_day_dates
end
end

require 'event_calendar/railtie' if defined?(::Rails::Railtie)
require 'event_calendar/railtie' if defined?(::Rails::Railtie)