aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/dynamic_matchers.rb
diff options
context:
space:
mode:
authorMaximilian Schneider <mail@maximilianschneider.net>2012-06-22 16:44:01 +0200
committerMaximilian Schneider <mail@maximilianschneider.net>2012-06-22 16:44:01 +0200
commitf984b8152fb497919b30c9c96e471e0736f3a6d2 (patch)
tree7d8d56d7e662157a2b6c7c965c42263ebdda5a97 /activerecord/lib/active_record/dynamic_matchers.rb
parent323ee207cbbcd66574045ebedd30765da10d3f6f (diff)
downloadrails-f984b8152fb497919b30c9c96e471e0736f3a6d2.tar.gz
rails-f984b8152fb497919b30c9c96e471e0736f3a6d2.tar.bz2
rails-f984b8152fb497919b30c9c96e471e0736f3a6d2.zip
made dynamic finders alias_attribute aware
previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
Diffstat (limited to 'activerecord/lib/active_record/dynamic_matchers.rb')
-rw-r--r--activerecord/lib/active_record/dynamic_matchers.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb
index 23aaa319d8..a37cde77ee 100644
--- a/activerecord/lib/active_record/dynamic_matchers.rb
+++ b/activerecord/lib/active_record/dynamic_matchers.rb
@@ -53,6 +53,7 @@ module ActiveRecord
@model = model
@name = name.to_s
@attribute_names = @name.match(self.class.pattern)[1].split('_and_')
+ @attribute_names.map! { |n| @model.attribute_aliases[n] || n }
end
def valid?