aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/dynamic_matchers.rb
diff options
context:
space:
mode:
authorRob Looby <robertjlooby@gmail.com>2015-05-08 13:52:33 -0500
committerRob Looby <robertjlooby@gmail.com>2015-05-08 15:28:28 -0500
commitad389286bbce5a43de34dc2df3968fa1f47181e1 (patch)
treedbfc594fd00406900ce7e4a207b3ec2a143e839c /activerecord/lib/active_record/dynamic_matchers.rb
parent6d951bda36c60d3d377ef63b22a855fbd2735df3 (diff)
downloadrails-ad389286bbce5a43de34dc2df3968fa1f47181e1.tar.gz
rails-ad389286bbce5a43de34dc2df3968fa1f47181e1.tar.bz2
rails-ad389286bbce5a43de34dc2df3968fa1f47181e1.zip
put dynamic matchers on the GeneratedAssociationMethods instead of model
Diffstat (limited to 'activerecord/lib/active_record/dynamic_matchers.rb')
-rw-r--r--activerecord/lib/active_record/dynamic_matchers.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb
index b6dd6814db..78fac1f3bb 100644
--- a/activerecord/lib/active_record/dynamic_matchers.rb
+++ b/activerecord/lib/active_record/dynamic_matchers.rb
@@ -16,7 +16,7 @@ module ActiveRecord
if match && match.valid?
match.define
- send(name, *arguments, &block)
+ generated_association_methods.send(name, *arguments, &block)
else
super
end
@@ -60,7 +60,7 @@ module ActiveRecord
end
def define
- model.class_eval <<-CODE, __FILE__, __LINE__ + 1
+ model.generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
def self.#{name}(#{signature})
#{body}
end
@@ -70,7 +70,7 @@ module ActiveRecord
private
def body
- "#{finder}(#{attributes_hash})"
+ "#{model}.#{finder}(#{attributes_hash})"
end
# The parameters in the signature may have reserved Ruby words, in order