Skip to content

Instantly share code, notes, and snippets.

@azuby
Forked from mrpunkin/gist:1895554
Created February 23, 2012 23:02
Show Gist options
  • Save azuby/1895590 to your computer and use it in GitHub Desktop.
Save azuby/1895590 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
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