From ce140a7fc8eb6bea5a567e7c6681087db0055fb4 Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 28 Mar 2009 18:20:02 +0100 Subject: introducing named scope :drafts for Page --- app/models/page.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models') diff --git a/app/models/page.rb b/app/models/page.rb index 45a05dc..0bebb84 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -5,6 +5,14 @@ class Page < ActiveRecord::Base PUBLIC_TEMPLATE_PATH = File.join(%w(custom page_templates public)) FULL_PUBLIC_TEMPLATE_PATH = File.join(RAILS_ROOT, 'app', 'views', PUBLIC_TEMPLATE_PATH) + # named scopes + + named_scope( + :drafts, + :include => [:node, :user, :globalize_translations], + :conditions => ["nodes.draft_id = pages.id"] + ) + # Mixins and Plugins acts_as_taggable acts_as_list :column => :revision, :scope => :node_id -- cgit v1.3