test/test_helper.rb in destroyed_at-1.0.1 vs test/test_helper.rb in destroyed_at-1.0.2
- old
+ new
@@ -31,10 +31,11 @@
ActiveRecord::Base.connection.execute(%{CREATE TABLE avatars (id INTEGER PRIMARY KEY, author_id INTEGER, destroyed_at DATETIME);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE categories (id INTEGER PRIMARY KEY);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE categorizations (id INTEGER PRIMARY KEY, category_id INTEGER, post_id INTEGER);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE comments (id INTEGER PRIMARY KEY, commenter_id INTEGER, post_id INTEGER, destroyed_at DATETIME);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE commenters (id INTEGER PRIMARY KEY, destroyed_at DATETIME);})
+ActiveRecord::Base.connection.execute(%{CREATE TABLE destructive_children (id INTEGER PRIMARY KEY, person_id INTEGER, destroyed_at DATETIME);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE images (id INTEGER PRIMARY KEY, post_id INTEGER);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE posts (id INTEGER PRIMARY KEY, author_id INTEGER, destroyed_at DATETIME);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE people (id INTEGER PRIMARY KEY);})
ActiveRecord::Base.connection.execute(%{CREATE TABLE pets (id INTEGER PRIMARY KEY, person_id INTEGER);})
@@ -42,10 +43,11 @@
has_many :posts
has_one :avatar, dependent: :destroy
end
class Person < ActiveRecord::Base
+ has_many :destructive_children
has_one :pet, dependent: :destroy
end
class Pet < ActiveRecord::Base
belongs_to :person
@@ -74,9 +76,13 @@
class Commenter < ActiveRecord::Base
include DestroyedAt
has_many :comments, dependent: :destroy
has_many :posts, through: :comments
+end
+
+class DestructiveChild < ActiveRecord::Base
+ belongs_to :person, dependent: :destroy
end
class Post < ActiveRecord::Base
include DestroyedAt