Skip to content

Instantly share code, notes, and snippets.

@rvanlieshout
Created February 10, 2012 07:05
Show Gist options
  • Save rvanlieshout/1787324 to your computer and use it in GitHub Desktop.
Save rvanlieshout/1787324 to your computer and use it in GitHub Desktop.
scope :between, lambda { |start_date, end_date|
joins(sanitize_sql_array(["INNER JOIN clocks clocks_between ON clocks_between.shift_id = shifts.id AND clocks_between.datetime BETWEEN (? AND ?)", start_date, end_date]))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment