diff options
Diffstat (limited to 'lib/active_relation/relations/relation.rb')
-rw-r--r-- | lib/active_relation/relations/relation.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb index 838697a2ac..0f770e674c 100644 --- a/lib/active_relation/relations/relation.rb +++ b/lib/active_relation/relations/relation.rb @@ -30,10 +30,8 @@ module ActiveRelation attribute_for_name(index) when ::Range Range.new(self, index) - when Attribute + when Attribute, Expression attribute_for_attribute(index) - when Expression - attribute_for_expression(index) end end @@ -110,12 +108,12 @@ module ActiveRelation ActiveRecord::Base.connection end - def attribute_for_attribute(attribute) - self == attribute.relation ? attribute : nil + def attribute_for_name(name) + nil end - def attribute_for_expression(expression) - nil + def attribute_for_attribute(attribute) + attributes.detect { |a| a =~ attribute } end def attributes; [] end |