Skip to content

Instantly share code, notes, and snippets.

@mcurtis
Created January 31, 2010 01:59
Show Gist options
  • Save mcurtis/290842 to your computer and use it in GitHub Desktop.
Save mcurtis/290842 to your computer and use it in GitHub Desktop.
def by_direction(condition, time, options = {}, &block)
field = 'end'
ensure_valid_options(options)
scoping = { :conditions => ["#{self.table_name}.#{field} #{condition} ?", time.utc] }.merge(options)
with_scope(:find => scoping) do
scoped_by(block) do
find(:all)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment