Skip to content

Instantly share code, notes, and snippets.

@mrpunkin
Created February 23, 2012 22:54
Show Gist options
  • Save mrpunkin/1895554 to your computer and use it in GitHub Desktop.
Save mrpunkin/1895554 to your computer and use it in GitHub Desktop.
def self.active
s = arel_table
where(
s[:begins_at].lteq(Time.now.utc).or(s[:begins_at].eq(nil)),
s[:ends_at].gt(Time.now.utc).or(s[:ends_at]).eq(nil))
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment