BigW Consortium Gitlab

Commit 90c2e0d9 by Marin Jankovski

Replace now forbidden keywords public and private for snippets scope

parent 51d5e4cd
......@@ -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]) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment