All scopes must be in lambdas
This commit is contained in:
parent
9a22ac63ec
commit
b5db541338
9 changed files with 22 additions and 22 deletions
|
@ -31,9 +31,9 @@ class Snippet < ActiveRecord::Base
|
|||
validates :content, presence: true
|
||||
|
||||
# Scopes
|
||||
scope :fresh, order("created_at DESC")
|
||||
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
|
||||
scope :expired, where(["expires_at IS NOT NULL AND expires_at < ?", Time.current])
|
||||
scope :fresh, -> { order("created_at DESC") }
|
||||
scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) }
|
||||
scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) }
|
||||
|
||||
def self.content_types
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue