aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/blog_category.rb2
-rw-r--r--app/models/blog_post.rb2
-rw-r--r--db/migrate/1_create_blog_structure.rb2
3 files changed, 3 insertions, 3 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]
diff --git a/db/migrate/1_create_blog_structure.rb b/db/migrate/1_create_blog_structure.rb
index 197efb1..a93d2d4 100644
--- a/db/migrate/1_create_blog_structure.rb
+++ b/db/migrate/1_create_blog_structure.rb
@@ -30,7 +30,7 @@ class CreateBlogStructure < ActiveRecord::Migration
add_index :blog_categories, :id
- create_table :blog_categories_blog_posts, :id => false do |t|
+ create_table :blog_categories_blog_posts, :id => true do |t|
t.integer :blog_category_id
t.integer :blog_post_id
end