app/models/alchemy/page/page_scopes.rb in alchemy_cms-3.2.1 vs app/models/alchemy/page/page_scopes.rb in alchemy_cms-3.3.0.rc1

- old
+ new

@@ -1,7 +1,6 @@ module Alchemy - # ActiveRecord scopes for Alchemy::Page # module Page::PageScopes extend ActiveSupport::Concern @@ -14,17 +13,17 @@ # scope :layoutpages, -> { where(layoutpage: true) } # All locked pages # - scope :all_locked, -> { where(locked: true) } + scope :locked, -> { where(locked: true) } # All pages locked by given user # - scope :all_locked_by, ->(user) { + scope :locked_by, ->(user) { if user.class.respond_to? :primary_key - all_locked.where(locked_by: user.send(user.class.primary_key)) + locked.where(locked_by: user.send(user.class.primary_key)) end } # All not locked pages # @@ -48,11 +47,11 @@ # All pages that are a published language root # scope :public_language_roots, -> { published.language_roots.where( - language_code: Language.published.pluck(:code) + language_code: Language.published.pluck(:language_code) ) } # Last 5 pages that where recently edited by given user # @@ -66,11 +65,13 @@ where(language_id: language_id) } # Returns all content pages. # - scope :contentpages, -> { where(layoutpage: [false, nil]).where(Page.arel_table[:parent_id].not_eq(nil)) } + scope :contentpages, -> { + where(layoutpage: [false, nil]).where(Page.arel_table[:parent_id].not_eq(nil)) + } # Returns all public contentpages that are not locked. # # Used for flushing all pages caches at once. # @@ -96,8 +97,7 @@ # All pages for xml sitemap # scope :sitemap, -> { from_current_site.published.contentpages.where(sitemap: true) } end - end end