Skip to content

Instantly share code, notes, and snippets.

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