Class: ConnectionAdapter
- Inherits:
-
Object
- Object
- ConnectionAdapter
- Defined in:
- lib/templates/activerecord/lib/support/connection_adapter.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
Instance Method Summary collapse
- #connect! ⇒ Object
-
#initialize(database, adapter = "sqlite3") ⇒ ConnectionAdapter
constructor
A new instance of ConnectionAdapter.
Constructor Details
#initialize(database, adapter = "sqlite3") ⇒ ConnectionAdapter
Returns a new instance of ConnectionAdapter.
4 5 6 7 |
# File 'lib/templates/activerecord/lib/support/connection_adapter.rb', line 4 def initialize(database, adapter="sqlite3") @adapter = adapter @database = database end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
2 3 4 |
# File 'lib/templates/activerecord/lib/support/connection_adapter.rb', line 2 def adapter @adapter end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
2 3 4 |
# File 'lib/templates/activerecord/lib/support/connection_adapter.rb', line 2 def database @database end |
Instance Method Details
#connect! ⇒ Object
9 10 11 12 13 14 |
# File 'lib/templates/activerecord/lib/support/connection_adapter.rb', line 9 def connect! ActiveRecord::Base.establish_connection( :adapter => self.adapter, :database => self.database ) end |