diff options
author | Rob Looby <robertjlooby@gmail.com> | 2015-05-08 13:52:33 -0500 |
---|---|---|
committer | Rob Looby <robertjlooby@gmail.com> | 2015-05-08 15:28:28 -0500 |
commit | ad389286bbce5a43de34dc2df3968fa1f47181e1 (patch) | |
tree | dbfc594fd00406900ce7e4a207b3ec2a143e839c /activerecord/test/models | |
parent | 6d951bda36c60d3d377ef63b22a855fbd2735df3 (diff) | |
download | rails-ad389286bbce5a43de34dc2df3968fa1f47181e1.tar.gz rails-ad389286bbce5a43de34dc2df3968fa1f47181e1.tar.bz2 rails-ad389286bbce5a43de34dc2df3968fa1f47181e1.zip |
put dynamic matchers on the GeneratedAssociationMethods instead of model
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/electron.rb | 8 |
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 |