Class: ActiveRecord::TemporaryTable
- Defined in:
- lib/ar-extensions/temporary_table.rb
Constant Summary
Constants inherited from Base
Base::AREXT_RAILS_COLUMNS, Base::AREXT_RAILS_COLUMN_NAMES
Class Method Summary collapse
-
.drop ⇒ Object
Drops a temporary table from the database and removes the temporary table constant.
Methods inherited from Base
create_temporary_table, fulltext, import, import_from_table, import_with_validations, import_without_validations_or_callbacks, insert_select, quote_column_names, supports_full_text_searching?, supports_import?, supports_on_duplicate_key_update?, supports_temporary_tables?, #synchronize, synchronize
Methods included from Extensions::ForeignKeys
Class Method Details
.drop ⇒ Object
Drops a temporary table from the database and removes the temporary table constant.
Example
Project.create_temporary_table
Object.const_defined?( :TempProject ) # => true
TempProject.drop
Object.const_defined?( :TempProject ) # => false
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ar-extensions/temporary_table.rb', line 112 def self.drop if @@temporary_table_hsh[ self ] sql = 'DROP TABLE ' + self.table_name + ';' connection.execute( sql ) Object.send( :remove_const, self.name.to_sym ) @@temporary_table_hsh.delete( self ) else raise StandardError.new( "Trying to drop nonexistance temporary table: #{self.name}" ) end end |