aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/table.rb')
-rw-r--r--lib/arel/table.rb34
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/arel/table.rb b/lib/arel/table.rb
index aa23a7d601..e7a626a4c6 100644
--- a/lib/arel/table.rb
+++ b/lib/arel/table.rb
@@ -17,7 +17,6 @@ module Arel
if Hash === engine
@engine = engine[:engine] || Table.engine
- @columns = attributes_for engine[:columns]
# Sometime AR sends an :as parameter to table, to let the table know
# that it is an Alias. We may want to override new, and return a
@@ -46,7 +45,7 @@ module Arel
def joins manager
if $VERBOSE
- warn "joins is deprecated and will be removed in 2.2"
+ warn "joins is deprecated and will be removed in 3.0.0"
warn "please remove your call to joins from #{caller.first}"
end
nil
@@ -93,41 +92,46 @@ module Arel
end
def columns
+ if $VERBOSE
+ warn <<-eowarn
+(#{caller.first}) Arel::Table#columns is deprecated and will be removed in
+Arel 3.0.0 with no replacement. PEW PEW PEW!!!
+ eowarn
+ end
@columns ||=
attributes_for @engine.connection.columns(@name, "#{@name} Columns")
end
def [] name
- return nil unless table_exists?
-
- name = name.to_sym
- columns.find { |column| column.name == name }
+ ::Arel::Attribute.new self, name.to_sym
end
def select_manager
SelectManager.new(@engine)
end
+ def insert_manager
+ InsertManager.new(@engine)
+ end
+
private
def attributes_for columns
return nil unless columns
columns.map do |column|
- Attributes.for(column).new self, column.name.to_sym, column
+ Attributes.for(column).new self, column.name.to_sym
end
end
- def table_exists?
- @table_exists ||= tables.key?(@name) || engine.connection.table_exists?(name)
- end
-
- def tables
- self.class.table_cache(@engine)
- end
-
@@table_cache = nil
def self.table_cache engine # :nodoc:
+ if $VERBOSE
+ warn <<-eowarn
+(#{caller.first}) Arel::Table.table_cache is deprecated and will be removed in
+Arel 3.0.0 with no replacement. PEW PEW PEW!!!
+ eowarn
+ end
@@table_cache ||= Hash[engine.connection.tables.map { |x| [x,true] }]
end
end