From b5db541338314b01423d79fb9155e8c4ddc5d494 Mon Sep 17 00:00:00 2001 From: Andrew8xx8 Date: Tue, 12 Feb 2013 11:16:45 +0400 Subject: All scopes must be in lambdas --- app/models/snippet.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/models/snippet.rb') diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 806d346cf10..c4ee35e0556 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -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 [ -- cgit v1.2.1