lib/arel/engines/sql/relations/table.rb in arel-0.2.pre vs lib/arel/engines/sql/relations/table.rb in arel-0.2.0
- old
+ new
@@ -9,11 +9,11 @@
@name = name.to_s
if options.is_a?(Hash)
@options = options
@engine = options[:engine] || Table.engine
- @table_alias = options[:as].to_s if options[:as].present?
+ @table_alias = options[:as].to_s if options[:as].present? && options[:as].to_s != @name
else
@engine = options # Table.new('foo', engine)
end
end
@@ -50,11 +50,12 @@
def reset
@attributes = @columns = nil
end
def ==(other)
- Table === other and
- name == other.name
+ Table === other and
+ name == other.name and
+ table_alias == other.table_alias
end
end
end
def Table(name, engine = Arel::Table.engine)