aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/blog_category.rb
diff options
context:
space:
mode:
authorJoe Sak <joe@joesak.com>2011-02-15 23:20:07 -0600
committerJoe Sak <joe@joesak.com>2011-02-15 23:23:17 -0600
commit652ecc4707f2e6ee019e1864179ffcaf76706ed2 (patch)
treedb293583a180fb79902b1a4f2f50b25b8ce1caf2 /app/models/blog_category.rb
parent2b86be50d2c8e1299e729be6f90a03b4631956ba (diff)
downloadrefinerycms-blog-652ecc4707f2e6ee019e1864179ffcaf76706ed2.tar.gz
refinerycms-blog-652ecc4707f2e6ee019e1864179ffcaf76706ed2.tar.bz2
refinerycms-blog-652ecc4707f2e6ee019e1864179ffcaf76706ed2.zip
Closes GH-37. Move habtm assn to a has_many :through so posts can be ordered by published_at DESC on category#show view
Diffstat (limited to 'app/models/blog_category.rb')
-rw-r--r--app/models/blog_category.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb
index 8ffe834..fbd5465 100644
--- a/app/models/blog_category.rb
+++ b/app/models/blog_category.rb
@@ -1,6 +1,7 @@
class BlogCategory < ActiveRecord::Base
- has_and_belongs_to_many :posts, :class_name => 'BlogPost'
+ has_many :categorizations
+ has_many :posts, :through => :categorizations, :source => :blog_post, :order => 'published_at DESC'
acts_as_indexed :fields => [:title]