aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJoe Sak <joe@joesak.com>2011-07-18 14:56:46 -0500
committerJoe Sak <joe@joesak.com>2011-07-18 14:56:51 -0500
commitb78486ce1ede4e5c384a2e0561173549925d21a1 (patch)
treeeb7cf4702c12502ccfc644071c8cebd01075c405 /app/models
parent98b6052f1f3ac9a99efd18f17d8d33d2da990589 (diff)
downloadrefinerycms-blog-b78486ce1ede4e5c384a2e0561173549925d21a1.tar.gz
refinerycms-blog-b78486ce1ede4e5c384a2e0561173549925d21a1.tar.bz2
refinerycms-blog-b78486ce1ede4e5c384a2e0561173549925d21a1.zip
categorization has_many :through should have an ID, and the relationship should be destroyed if the blog post or category is
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog_category.rb2
-rw-r--r--app/models/blog_post.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb
index 263982c..b66a94d 100644
--- a/app/models/blog_category.rb
+++ b/app/models/blog_category.rb
@@ -1,6 +1,6 @@
class BlogCategory < ActiveRecord::Base
- has_many :categorizations
+ has_many :categorizations, :dependent => :destroy
has_many :posts, :through => :categorizations, :source => :blog_post
acts_as_indexed :fields => [:title]
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index c9e93bf..e03be99 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -13,7 +13,7 @@ class BlogPost < ActiveRecord::Base
has_many :comments, :class_name => 'BlogComment', :dependent => :destroy
acts_as_taggable
- has_many :categorizations
+ has_many :categorizations, :dependent => :destroy
has_many :categories, :through => :categorizations, :source => :blog_category
acts_as_indexed :fields => [:title, :body]