Skip to content

Instantly share code, notes, and snippets.

@nathany
Created December 3, 2010 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathany/727315 to your computer and use it in GitHub Desktop.
Save nathany/727315 to your computer and use it in GitHub Desktop.
Sometimes my Ruby code has enough parens, it might as well be Lisp
# find admin users assigned to a given set of sites
named_scope :assigned_to_sites, lambda { |site_ids|
{
:joins => :admin_user_site_assignments,
:conditions => {
:admin_user_site_assignments => {:site_id => site_ids}
}
}
}
def in_booking_window?
(begin_booking_at.nil? or Time.now.utc >= begin_booking_at) and (end_booking_at.nil? or Time.now.utc <= end_booking_at)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment