Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/amalgalite_adapter.rb

Class Method Summary collapse

Class Method Details

.amalgalite_connection(config) ⇒ Object

:nodoc:

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_record/connection_adapters/amalgalite_adapter.rb', line 16

def amalgalite_connection( config ) # :nodoc:
  config[:database] ||= config[:dbfile]
  raise ArgumentError, "No database file specified.  Missing argument: database" unless config[:database]

  # Allow database path relative to RAILS_ROOT, but only if the database
  # is not the in memory database
  if Object.const_defined?( :RAILS_ROOT ) and (":memory:" != config[:database] ) then
    config[:database] = File.expand_path( config[:database], RAILS_ROOT )
  end

  db = ::Amalgalite::Database.new( config[:database] )
  ConnectionAdapters::AmalgaliteAdapter.new( db, logger )
end