| Class | ActiveRecord::TemporaryTable |
| In: |
lib/ar-extensions/temporary_table.rb
|
| Parent: | ActiveRecord::Base |
Drops a temporary table from the database and removes the temporary table constant.
Project.create_temporary_table Object.const_defined?( :TempProject ) # => true TempProject.drop Object.const_defined?( :TempProject ) # => false
# File lib/ar-extensions/temporary_table.rb, line 121
121: def self.drop
122: if @@temporary_table_hsh[ self ]
123: sql = 'DROP TABLE ' + self.table_name + ';'
124: connection.execute( sql )
125: Object.send( :remove_const, self.name.to_sym )
126: @@temporary_table_hsh.delete( self )
127: else
128: raise StandardError.new( "Trying to drop nonexistance temporary table: #{self.name}" )
129: end
130: end