Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb
- index e0dac01f4a..ebba6b28b7 100644
- --- a/activerecord/test/cases/associations/inner_join_association_test.rb
- +++ b/activerecord/test/cases/associations/inner_join_association_test.rb
- @@ -13,7 +13,18 @@
- class InnerJoinAssociationTest < ActiveRecord::TestCase
- fixtures :authors, :author_addresses, :essays, :posts, :comments, :categories, :categories_posts, :categorizations,
- - :taggings, :tags
- + :taggings, :tags, :people
- +
- + def test_includes
- + person = Person.includes(agents: { agents: :agents }).last
- +
- + assert person
- + assert_no_queries do
- + assert person.agents.last
- + assert person.agents.last.agents.last
- + assert person.agents.last.agents.last.primary_contact.agents.last.agents.last
- + end
- + end
- def test_construct_finder_sql_applies_aliases_tables_on_association_conditions
- result = Author.joins(:thinking_posts, :welcome_posts).to_a
- diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb
- index 0dfd29e45e..99e8cdc464 100644
- --- a/activerecord/test/models/person.rb
- +++ b/activerecord/test/models/person.rb
- @@ -28,7 +28,7 @@ class Person < ActiveRecord::Base
- has_many :jobs_with_dependent_nullify, source: :job, through: :references, dependent: :nullify
- belongs_to :primary_contact, class_name: "Person"
- - has_many :agents, class_name: "Person", foreign_key: "primary_contact_id"
- + has_many :agents, class_name: "Person", foreign_key: "primary_contact_id", inverse_of: :primary_contact
- has_many :agents_of_agents, through: :agents, source: :agents
- belongs_to :number1_fan, class_name: "Person"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement