Class: Coupler::Models::Connection

Inherits:
Sequel::Model
  • Object
show all
Includes:
CommonModel
Defined in:
lib/coupler/models/connection.rb

Constant Summary collapse

ADAPTERS =
{
  :name => "mysql", :label => "MySQL",
  :ignored_attributes => %w{path}
},
{
  :name => "h2", :label => "H2",
  :ignored_attributes => %w{host port username password database_name}
}

Instance Method Summary collapse

Methods included from CommonModel

#after_destroy, #after_save, #before_create, #before_save, #before_update, included, #save!, #touch!

Instance Method Details

#database(&block) ⇒ Object



19
20
21
22
23
24
# File 'lib/coupler/models/connection.rb', line 19

def database(&block)
  Sequel.connect(connection_string, {
    :loggers => [Coupler::Logger.instance],
    :max_connections => 20
  }, &block)
end

#deletable?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/coupler/models/connection.rb', line 26

def deletable?
  resources_dataset.count == 0
end