Sha256: 510718a819b4cff3d257e1245866a76d258b28cd11edab515199f40b54ecab9a

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

# Abstract base class for an ActiveRecord adapter

module Castronaut::Adapters
  class ActiveRecordAdapter < Base
  
    # You must provide user_class.
    
    def self.configure options
      self.user_class.establish_connection(options['database'])
      self.user_class.logger = options['logger']
      
      unless ENV["test"] == "true"
        if self.user_class.connection.tables.empty?
          STDERR.puts "#{self.class} - There are no tables in the given database.\nConfig details:\n#{options.inspect}"
          Kernel.exit(0)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
3mix-castronaut-0.5.0.2 lib/castronaut/adapters/active_record_adapter.rb
masover-castronaut-0.4.4.4 lib/castronaut/adapters/active_record_adapter.rb
masover-castronaut-0.4.4.5 lib/castronaut/adapters/active_record_adapter.rb
masover-castronaut-0.5.0.1 lib/castronaut/adapters/active_record_adapter.rb