aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-09 05:50:42 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-09 05:50:42 -0300
commitd5ba9a42a6e93b163a49f99d739aa56820e044d0 (patch)
treebb70a8bc3405c711fb18458b48937a5c93d4dcbd /activerecord/test/models
parent30c503395bf6bf7db1ec0295bd661ce644628db5 (diff)
parentad389286bbce5a43de34dc2df3968fa1f47181e1 (diff)
downloadrails-d5ba9a42a6e93b163a49f99d739aa56820e044d0.tar.gz
rails-d5ba9a42a6e93b163a49f99d739aa56820e044d0.tar.bz2
rails-d5ba9a42a6e93b163a49f99d739aa56820e044d0.zip
Merge pull request #20080 from robertjlooby/fix_overwriting_by_dynamic_finders
put dynamic matchers on GeneratedAssociationMethods instead of model
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/electron.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/electron.rb b/activerecord/test/models/electron.rb
index 6fc270673f..aacdaa71b7 100644
--- a/activerecord/test/models/electron.rb
+++ b/activerecord/test/models/electron.rb
@@ -2,4 +2,12 @@ class Electron < ActiveRecord::Base
belongs_to :molecule
validates_presence_of :name
+
+ cattr_reader :times_called_find_by_name
+ @@times_called_find_by_name = 0
+
+ def self.find_by_name(name)
+ @@times_called_find_by_name += 1
+ super(name)
+ end
end