aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-20 13:38:06 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-20 13:38:06 -0300
commit79bcab79d97239593c8f9500c70226abada341c6 (patch)
tree3c1aec608cd521e19e183ccf5147d19dda54b3ab /activerecord/test/models
parentb66bb42dc172716d29fb33c97799f1786af3ce9f (diff)
parent431f8e01196044877c2acea4271410b1033ec915 (diff)
downloadrails-79bcab79d97239593c8f9500c70226abada341c6.tar.gz
rails-79bcab79d97239593c8f9500c70226abada341c6.tar.bz2
rails-79bcab79d97239593c8f9500c70226abada341c6.zip
Merge pull request #16172 from Agis-/hmt_scope_arity
has_many :through with dynamic condition merging
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/comment.rb1
-rw-r--r--activerecord/test/models/developer.rb2
2 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index 15970758db..7a88299d08 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -9,6 +9,7 @@ class Comment < ActiveRecord::Base
belongs_to :post, :counter_cache => true
belongs_to :author, polymorphic: true
belongs_to :resource, polymorphic: true
+ belongs_to :developer
has_many :ratings
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index 5bd2f00129..3627cfdd09 100644
--- a/activerecord/test/models/developer.rb
+++ b/activerecord/test/models/developer.rb
@@ -46,6 +46,8 @@ class Developer < ActiveRecord::Base
has_many :audit_logs
has_many :contracts
has_many :firms, :through => :contracts, :source => :firm
+ has_many :comments, ->(developer) { where(body: "I'm #{developer.name}") }
+ has_many :ratings, through: :comments
scope :jamises, -> { where(:name => 'Jamis') }