diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 6 | ||||
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 31 | ||||
-rw-r--r-- | activerecord/test/schema/schema.rb | 1 |
3 files changed, 7 insertions, 31 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index b17ca22544..7e40373163 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,7 +1,7 @@ -* PostgreSQL renaming table doesn't attempt to rename non existent sequences - +* PostgreSQL renaming table doesn't attempt to rename non existent sequences. + *Abdelkader Boudih* - + * Move 'dependent: :destroy' handling for 'belongs_to' from 'before_destroy' to 'after_destroy' callback chain diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 65b6068df4..4238681905 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -936,38 +936,13 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase end end +unless current_adapter?(:MysqlAdapter, :Mysql2Adapter) class BelongsToWithForeignKeyTest < ActiveRecord::TestCase - def setup - ActiveRecord::Schema.define do - drop_table :authors, if_exists: true - drop_table :author_addresses, if_exists: true - - create_table :author_addresses do |t| - end - - exec_query <<-eos - create table authors( - id int, - author_address_id int, - name varchar(255), - PRIMARY KEY (id), - FOREIGN KEY (author_address_id) REFERENCES author_addresses(id) - ); - eos - end - end - - def teardown - ActiveRecord::Schema.define do - drop_table :authors, if_exists: true - drop_table :author_addresses, if_exists: true - end - end - def test_destroy_linked_models address = AuthorAddress.create! - author = Author.create! id: 1, name: "Author", author_address_id: address.id + author = Author.create! name: "Author", author_address_id: address.id author.destroy! end end +end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 03d33c151a..be134fde11 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -83,6 +83,7 @@ ActiveRecord::Schema.define do create_table :author_addresses, force: true do |t| end + add_foreign_key :authors, :author_address create_table :author_favorites, force: true do |t| t.column :author_id, :integer |