lib/plate/helpers/blogging_helper.rb in plate-0.5.3 vs lib/plate/helpers/blogging_helper.rb in plate-0.5.4
- old
+ new
@@ -55,9 +55,14 @@
# Returns a number of where this post is in all posts
def post_index
@post_index ||= self.posts.index(self.post)
end
+ # Find all posts for the given category
+ def posts_for_category(category)
+ self.posts.select { |p| p.category == category }
+ end
+
# Find all posts for the given year, month and optional category.
def posts_for_month(year, month, category = nil)
result = []
if months = self.posts.archives[year.to_s]
\ No newline at end of file