Skip to content

Instantly share code, notes, and snippets.

View simonreed's full-sized avatar

Simon Reed simonreed

View GitHub Profile
@simonreed
simonreed / _queries.rb
Last active February 15, 2016 20:40 — forked from chrismahon/_queries.rb
Appointment Scheduler
# Show me all available TimeSlots for a Staff member for a Service on a Day
@staff.time_slots.available.by_date(Date.today)
# Show me all available TimeSlots for a Service on a Day
@service.time_slots.available.by_date(Date.today)
# Show me all available TimeSlots for a Staff member for a Service between 2 Days grouped by Day
@staff.time_slots.available.between_dates(Date.today, Date.today + 5.days).group_by(&:date)
# Show me all available TimeSlots for a Service between 2 Days grouped by Day