aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-06 14:19:09 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-06 14:19:09 -0700
commit60f8668d41d45b21d962bdc534bbc417d22e701b (patch)
tree15131513be7a917fbbb2b9f02ec201c4fd2837bc
parentc86f94986d60d607f374ef01f9b6428fc64ddc81 (diff)
downloadrails-60f8668d41d45b21d962bdc534bbc417d22e701b.tar.gz
rails-60f8668d41d45b21d962bdc534bbc417d22e701b.tar.bz2
rails-60f8668d41d45b21d962bdc534bbc417d22e701b.zip
initializing instance variables, converting to attr-reader
-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