aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJoe Sak <joe@joesak.com>2011-02-16 00:12:40 -0600
committerJoe Sak <joe@joesak.com>2011-02-16 00:12:40 -0600
commitf520d6c6e73407386f36b25da2595ff070da8c7a (patch)
tree771f8c4b7fe28d4205ffe7eb8cdc888c1637f0c4 /app
parent3ecdeae3b004ecf2357b198551e03d39e79462b4 (diff)
downloadrefinerycms-blog-f520d6c6e73407386f36b25da2595ff070da8c7a.tar.gz
refinerycms-blog-f520d6c6e73407386f36b25da2595ff070da8c7a.tar.bz2
refinerycms-blog-f520d6c6e73407386f36b25da2595ff070da8c7a.zip
Add class method to find uncategorized posts
Diffstat (limited to 'app')
-rw-r--r--app/models/blog_post.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index 1d01a20..ed1e14c 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -26,7 +26,7 @@ class BlogPost < ActiveRecord::Base
scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).order("published_at DESC").limit(1) }
scope :next, lambda { |i| where(["published_at > ? and draft = ?", i.published_at, false]).order("published_at ASC").limit(1) }
-
+
def next
self.class.next(self).first
end
@@ -51,6 +51,10 @@ class BlogPost < ActiveRecord::Base
:scoping => 'blog'
})
end
+
+ def uncategorized
+ posts = BlogPost.live.reject { |p| p.categories.any? }
+ end
end
module ShareThis