Skip to content

Instantly share code, notes, and snippets.

@chrisconley
Created December 9, 2011 16:47
Show Gist options
  • Save chrisconley/1452308 to your computer and use it in GitHub Desktop.
Save chrisconley/1452308 to your computer and use it in GitHub Desktop.
ActionController::Base.logger = Logger.new(STDOUT)
l = Licensee.find_by_subdomain('jennaavery')
LicenseeScopedModel.with_licensee(l) { Session.all({
:conditions => [
'sessions.start_day >= ? AND sessions.start_day <= ? AND sessions.locked_down_at is NULL',
Session.days_to_renew.days.ago.to_date - 2.days,
Session.days_to_renew.days.ago.to_date
]
})}
# => [#<Session id: 166, start_day: "2011-11-28", end_day: "2011-12-25", licensee_id: 11, created_at: "2011-11-22 18:08:15", updated_at: "2011-11-22 18:08:15", auto_renew: true, active_user_count_on_lockdown: nil, lockdown_warning_sent_at: nil, locked_down_at: nil, billed_at: nil, parent_id: nil, program_id: 20>]
LicenseeScopedModel.with_licensee(l) { Session.needing_lockdown}
# => []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment