Replace now forbidden keywords public and private for snippets scope
This commit is contained in:
parent
51d5e4cd6e
commit
90c2e0d971
2 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,7 @@ class SnippetsController < ApplicationController
|
|||
layout 'navless'
|
||||
|
||||
def index
|
||||
@snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20)
|
||||
@snippets = Snippet.is_public.fresh.non_expired.page(params[:page]).per(20)
|
||||
end
|
||||
|
||||
def user_index
|
||||
|
|
|
@ -34,8 +34,8 @@ class Snippet < ActiveRecord::Base
|
|||
validates :content, presence: true
|
||||
|
||||
# Scopes
|
||||
scope :public, -> { where(private: false) }
|
||||
scope :private, -> { where(private: true) }
|
||||
scope :is_public, -> { where(private: false) }
|
||||
scope :is_private, -> { where(private: true) }
|
||||
scope :fresh, -> { order("created_at DESC") }
|
||||
scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) }
|
||||
scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) }
|
||||
|
|
Loading…
Reference in a new issue