aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/algebra/attributes/attribute.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb
index 5b391f86b0..16124abcc4 100644
--- a/lib/arel/algebra/attributes/attribute.rb
+++ b/lib/arel/algebra/attributes/attribute.rb
@@ -4,12 +4,17 @@ module Arel
class TypecastError < StandardError ; end
class Attribute
attr_reader :relation, :name, :alias, :ancestor, :hash
+ attr_reader :history, :root
def initialize(relation, name, options = {})
@relation = relation # this is actually a table (I think)
@name = name
@alias = options[:alias]
@ancestor = options[:ancestor]
+ @history = [self] + (@ancestor ? @ancestor.history : [])
+ @root = @history.last
+ @original_relation = nil
+ @original_attribute = nil
# FIXME: I think we can remove this eventually
@hash = name.hash + root.relation.class.hash
@@ -58,10 +63,6 @@ module Arel
bind(relation)
end
- def history
- @history ||= [self] + (ancestor ? ancestor.history : [])
- end
-
def join?
relation.join?
end