lib/arel/engines/sql/relations/table.rb in arel-1.0.0 vs lib/arel/engines/sql/relations/table.rb in arel-1.0.1
- old
+ new
@@ -11,12 +11,10 @@
def tables; @@tables; end
def tables= e; @@tables = e; end
end
attr_reader :name, :engine, :table_alias, :options, :christener
- attr_reader :table_exists
- alias :table_exists? :table_exists
def initialize(name, options = {})
@name = name.to_s
@table_exists = nil
@table_alias = nil
@@ -47,16 +45,18 @@
raise "#{@engine.adapter_name} is not supported by Arel."
end
end
@@tables ||= engine.connection.tables
- @table_exists = @@tables.include?(name) ||
- @engine.connection.table_exists?(name)
end
end
def as(table_alias)
Table.new(name, options.merge(:as => table_alias))
+ end
+
+ def table_exists?
+ @table_exists ||= @@tables.include?(name) || engine.connection.table_exists?(name)
end
def attributes
return @attributes if @attributes
if table_exists?