From 90c2e0d971b5c105224196b8509012f943c9ea9b Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 30 May 2014 17:21:14 +0200 Subject: [PATCH] Replace now forbidden keywords public and private for snippets scope --- app/controllers/snippets_controller.rb | 2 +- app/models/snippet.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 0dd941a48e2..59ad8ff907c 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -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 diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 720accd73dc..0727bb16398 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -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]) }