Class: DatabaseFlusher::ActiveRecord::AbstractAdapter
- Inherits:
-
Object
- Object
- DatabaseFlusher::ActiveRecord::AbstractAdapter
- Defined in:
- lib/database_flusher/active_record/adapters/abstract_adapter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#raw_connection ⇒ Object
readonly
Returns the value of attribute raw_connection.
Instance Method Summary collapse
- #delete(*tables) ⇒ Object
-
#initialize(connection) ⇒ AbstractAdapter
constructor
A new instance of AbstractAdapter.
Constructor Details
#initialize(connection) ⇒ AbstractAdapter
Returns a new instance of AbstractAdapter.
7 8 9 10 |
# File 'lib/database_flusher/active_record/adapters/abstract_adapter.rb', line 7 def initialize(connection) @connection = connection @raw_connection = connection.raw_connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/database_flusher/active_record/adapters/abstract_adapter.rb', line 5 def connection @connection end |
#raw_connection ⇒ Object (readonly)
Returns the value of attribute raw_connection.
5 6 7 |
# File 'lib/database_flusher/active_record/adapters/abstract_adapter.rb', line 5 def raw_connection @raw_connection end |
Instance Method Details
#delete(*tables) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/database_flusher/active_record/adapters/abstract_adapter.rb', line 12 def delete(*tables) disable_referential_integrity(*tables) do stmts = tables.map do |name| "DELETE FROM #{quote_table_name(name)}" end sql = stmts.join(';') execute_multi sql end end |