diff options
author | Philip Arndt <parndt@gmail.com> | 2010-08-26 15:51:30 +1200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2010-08-26 15:51:30 +1200 |
commit | f311f4dc549f188e5742b40b1ea360dc8ef77566 (patch) | |
tree | 51e48d842536ea2d0219fea7f5eccc0f436416df /app/models | |
parent | 747a1b3a4e9f9dd93fb364671371e503be2e17db (diff) | |
download | refinerycms-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.rb | 6 |
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 |