aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-08-26 15:51:30 +1200
committerPhilip Arndt <parndt@gmail.com>2010-08-26 15:51:30 +1200
commitf311f4dc549f188e5742b40b1ea360dc8ef77566 (patch)
tree51e48d842536ea2d0219fea7f5eccc0f436416df /app/models
parent747a1b3a4e9f9dd93fb364671371e503be2e17db (diff)
downloadrefinerycms-blog-f311f4dc549f188e5742b40b1ea360dc8ef77566.tar.gz
refinerycms-blog-f311f4dc549f188e5742b40b1ea360dc8ef77566.tar.bz2
refinerycms-blog-f311f4dc549f188e5742b40b1ea360dc8ef77566.zip
Blog categories now save onto their posts.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog_post.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index 025cc31..e58de59 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -15,10 +15,8 @@ class BlogPost < ActiveRecord::Base
named_scope :live, :conditions => {:draft => false}
def category_ids=(ids)
- self.categories.clear
-
- self.categories += ids.reject{|id| id.blank?}.collect {|c_id|
- category = Category.find(category_id.to_i) rescue nil
+ self.categories = ids.reject{|id| id.blank?}.collect {|c_id|
+ (BlogCategory.find(c_id.to_i) rescue nil)
}.compact
end