diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2019-04-29 12:31:41 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2019-05-02 13:25:18 +0200 |
commit | cce26c36cae49f0143ce2305dbf5b00cca0e53c1 (patch) | |
tree | b060c274d60717b37847c1e62800eb32fed3b789 /activerecord/test/models | |
parent | 730a7a1b7909095dd48b9f32bbae5fd5a023fa60 (diff) | |
download | rails-cce26c36cae49f0143ce2305dbf5b00cca0e53c1.tar.gz rails-cce26c36cae49f0143ce2305dbf5b00cca0e53c1.tar.bz2 rails-cce26c36cae49f0143ce2305dbf5b00cca0e53c1.zip |
Namespace association extension modules under the owner model
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/developer.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index c6574cf6e7..92d01ba338 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -2,13 +2,13 @@ require "ostruct" -module DeveloperProjectsAssociationExtension2 - def find_least_recent - order("id ASC").first +class Developer < ActiveRecord::Base + module ProjectsAssociationExtension2 + def find_least_recent + order("id ASC").first + end end -end -class Developer < ActiveRecord::Base self.ignored_columns = %w(first_name last_name) has_and_belongs_to_many :projects do @@ -24,19 +24,19 @@ class Developer < ActiveRecord::Base has_and_belongs_to_many :shared_computers, class_name: "Computer" has_and_belongs_to_many :projects_extended_by_name, - -> { extending(DeveloperProjectsAssociationExtension) }, + -> { extending(ProjectsAssociationExtension) }, class_name: "Project", join_table: "developers_projects", association_foreign_key: "project_id" has_and_belongs_to_many :projects_extended_by_name_twice, - -> { extending(DeveloperProjectsAssociationExtension, DeveloperProjectsAssociationExtension2) }, + -> { extending(ProjectsAssociationExtension, ProjectsAssociationExtension2) }, class_name: "Project", join_table: "developers_projects", association_foreign_key: "project_id" has_and_belongs_to_many :projects_extended_by_name_and_block, - -> { extending(DeveloperProjectsAssociationExtension) }, + -> { extending(ProjectsAssociationExtension) }, class_name: "Project", join_table: "developers_projects", association_foreign_key: "project_id" do |