diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-13 09:46:30 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-13 09:46:42 -0700 |
commit | b483a0d2a75bbec2f5eee363c88238cb612f07d6 (patch) | |
tree | 40c6422cd8477ee299ace2505c9bd4258f253243 /activerecord/test/models | |
parent | 47e8bb10a421831f8119af91d7ca29c949268475 (diff) | |
download | rails-b483a0d2a75bbec2f5eee363c88238cb612f07d6.tar.gz rails-b483a0d2a75bbec2f5eee363c88238cb612f07d6.tar.bz2 rails-b483a0d2a75bbec2f5eee363c88238cb612f07d6.zip |
Ambiguous reflections are on :through relationships are no longer supported.
For example, you need to change this:
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts
end
class Post < ActiveRecord::Base
has_one :tagging
has_many :taggings
end
class Tagging < ActiveRecord::Base
end
To this:
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts, :source => :tagging
end
class Post < ActiveRecord::Base
has_one :tagging
has_many :taggings
end
class Tagging < ActiveRecord::Base
end
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index a96899ae10..af80b1ba42 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -85,7 +85,7 @@ class Author < ActiveRecord::Base has_many :author_favorites has_many :favorite_authors, -> { order('name') }, :through => :author_favorites - has_many :taggings, :through => :posts + has_many :taggings, :through => :posts, :source => :taggings has_many :taggings_2, :through => :posts, :source => :tagging has_many :tags, :through => :posts has_many :post_categories, :through => :posts, :source => :categories diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index dcda62e71d..b988184f34 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -141,7 +141,7 @@ class Client < Company belongs_to :firm_with_primary_key_symbols, :class_name => "Firm", :primary_key => :name, :foreign_key => :firm_name belongs_to :readonly_firm, -> { readonly }, :class_name => "Firm", :foreign_key => "firm_id" belongs_to :bob_firm, -> { where :name => "Bob" }, :class_name => "Firm", :foreign_key => "client_of" - has_many :accounts, :through => :firm + has_many :accounts, :through => :firm, :source => :accounts belongs_to :account class RaisedOnSave < RuntimeError; end |