diff options
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/expression.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/arel/algebra/expression.rb b/lib/arel/algebra/expression.rb index 875498c282..40baf5ece0 100644 --- a/lib/arel/algebra/expression.rb +++ b/lib/arel/algebra/expression.rb @@ -1,12 +1,15 @@ module Arel class Expression < Attribute - attributes :attribute, :alias, :ancestor - deriving :== - delegate :relation, :to => :attribute - alias_method :name, :alias + attr_reader :attribute + alias :name :alias def initialize(attribute, aliaz = nil, ancestor = nil) - @attribute, @alias, @ancestor = attribute, aliaz, ancestor + super(attribute.relation, aliaz, :alias => aliaz, :ancestor => ancestor) + @attribute = attribute + end + + def == other + super && Expression === other && attribute == other.attribute end def aggregation? |