diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-21 11:27:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-21 11:27:17 -0700 |
commit | 3c907173bd5a1eab82e29c802cacce887ad90cde (patch) | |
tree | 7994ff53b93fb556a494899cb0d80f92a231ece4 /lib | |
parent | 2f0a8ae8d4aed502a0b6c4780d4545c147bdcb47 (diff) | |
download | rails-3c907173bd5a1eab82e29c802cacce887ad90cde.tar.gz rails-3c907173bd5a1eab82e29c802cacce887ad90cde.tar.bz2 rails-3c907173bd5a1eab82e29c802cacce887ad90cde.zip |
reuse our superclass
Diffstat (limited to 'lib')
-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? |