aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/algebra/attributes/attribute.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb
index f1085aaae0..9206b228c8 100644
--- a/lib/arel/algebra/attributes/attribute.rb
+++ b/lib/arel/algebra/attributes/attribute.rb
@@ -3,14 +3,22 @@ require 'set'
module Arel
class TypecastError < StandardError ; end
class Attribute
- attributes :relation, :name, :alias, :ancestor
- deriving :==
+ attr_reader :relation, :name, :alias, :ancestor
delegate :engine, :christener, :to => :relation
def initialize(relation, name, options = {})
@relation, @name, @alias, @ancestor = relation, name, options[:alias], options[:ancestor]
end
+ def == other
+ super ||
+ Attribute === other &&
+ @relation == other.relation &&
+ @name == other.name &&
+ @alias == other.alias &&
+ @ancestor == other.ancestor
+ end
+
def named?(hypothetical_name)
(@alias || name).to_s == hypothetical_name.to_s
end