-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically generating associations that have a dependent option fo…
…r Archive (restoring a record automatically restores archived associations), starting on specs
- Loading branch information
Showing
22 changed files
with
199 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Records < ActiveRecord::Migration | ||
def self.up | ||
create_table :records do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.integer :belongs_to_id | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :records | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class BelongsTos < ActiveRecord::Migration | ||
def self.up | ||
create_table :belongs_tos do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :belongs_tos | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class HasOnes < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_ones do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.integer :record_id | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_ones | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class HasManies < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_manies do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.integer :record_id | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_manies | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class HasManyThroughThroughs < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_many_through_throughs do |t| | ||
t.integer :has_many_through_id | ||
t.integer :record_id | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_many_through_throughs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class HasManyThroughs < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_many_throughs do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_many_throughs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class HasOneThroughThroughs < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_one_through_throughs do |t| | ||
t.integer :record_id | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_one_through_throughs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class HasOneThroughs < ActiveRecord::Migration | ||
def self.up | ||
create_table :has_one_throughs do |t| | ||
t.string :string, :default => 'string' | ||
t.integer :integer, :default => '1' | ||
t.integer :has_one_through_through_id | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :has_one_throughs | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class BelongsTo < ActiveRecord::Base | ||
|
||
has_many :records, :dependent => :delete_all | ||
|
||
acts_as_archive | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class HasMany < ActiveRecord::Base | ||
|
||
belongs_to :record, :dependent => :delete | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HasManyThrough < ActiveRecord::Base | ||
|
||
has_many :has_many_through_throughs, :dependent => :delete_all | ||
has_many :records, :dependent => :delete_all, :through => :has_many_through_throughs | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HasManyThroughThrough < ActiveRecord::Base | ||
|
||
belongs_to :record, :dependent => :delete | ||
belongs_to :has_many_through, :dependent => :delete | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class HasOne < ActiveRecord::Base | ||
|
||
belongs_to :record, :dependent => :delete | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class HasOneThrough < ActiveRecord::Base | ||
|
||
belongs_to :has_one_through_through, :dependent => :delete | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HasOneThroughThrough < ActiveRecord::Base | ||
|
||
belongs_to :record, :dependent => :delete | ||
has_one :has_one_through, :dependent => :delete | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Record < ActiveRecord::Base | ||
|
||
belongs_to :belongs_to, :dependent => :destroy | ||
|
||
has_one :has_one, :dependent => :destroy | ||
|
||
has_many :has_manies, :dependent => :destroy | ||
|
||
has_many :has_many_through_throughs, :dependent => :destroy | ||
has_many :has_many_throughs, :dependent => :destroy, :through => :has_many_through_throughs | ||
|
||
has_one :has_one_through_through, :dependent => :destroy | ||
has_one :has_one_through, :dependent => :destroy, :through => :has_one_through_through | ||
|
||
acts_as_archive | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters