-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3377 from jacob-carlborg-apoex/namespaced-class-p…
…olymorphic-association-3376 Fix #3376: Polymorphic associations don't work with namespaced classes
- Loading branch information
Showing
9 changed files
with
63 additions
and
4 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 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,7 @@ | ||
module TwoLevel | ||
module Namespaced | ||
def self.table_name_prefix | ||
'two_level_namespaced_' | ||
end | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
spec/dummy_app/app/active_record/two_level/namespaced/polymorphic_association_test.rb
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,7 @@ | ||
module TwoLevel | ||
module Namespaced | ||
class PolymorphicAssociationTest < ActiveRecord::Base | ||
has_many :comments, as: :commentable | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
spec/dummy_app/app/mongoid/two_level/namespaced/polymorphic_association_test.rb
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 @@ | ||
module TwoLevel | ||
module Namespaced | ||
class PolymorphicAssociationTest | ||
include Mongoid::Document | ||
|
||
field :name, type: String | ||
|
||
has_many :comments, as: :commentable | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
...pp/db/migrate/20210811121027_create_two_level_namespaced_polymorphic_association_tests.rb
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,9 @@ | ||
class CreateTwoLevelNamespacedPolymorphicAssociationTests < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :two_level_namespaced_polymorphic_association_tests do |t| | ||
t.string :name | ||
|
||
t.timestamps | ||
end | ||
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
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