Module: Rails::Sequel

Defined in:
lib/sequel-rails/setup.rb,
lib/sequel-rails/railtie.rb,
lib/sequel-rails/runtime.rb,
lib/sequel-rails/storage.rb,
lib/sequel-rails/migrations.rb,
lib/sequel-rails/configuration.rb,
lib/sequel-rails/session_store.rb,
lib/sequel-rails/railties/i18n_support.rb,
lib/sequel-rails/railties/controller_runtime.rb

Defined Under Namespace

Modules: I18nSupport, Railties Classes: Configuration, Migrations, Railtie, SessionStore, Storage

Constant Summary collapse

@@connections =
{}

Class Method Summary collapse

Class Method Details

.connection(environment = nil) ⇒ Object

Get or setup a connection for a given environment



6
7
8
9
# File 'lib/sequel-rails/storage.rb', line 6

def self.connection(environment = nil)
  environment ||= Rails.env
  @@connections[environment] ||= setup(environment)
end

.reset_runtimeObject



5
6
7
8
9
10
# File 'lib/sequel-rails/runtime.rb', line 5

def reset_runtime
  @runtime ||= 0
  
  rt, @runtime = @runtime, 0
  rt
end

.setup(environment = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/sequel-rails/setup.rb', line 17

def self.setup(environment = nil)
  environment ||= Rails.env
  puts "[sequel] Setting up the #{environment.inspect} environment:"

  @@connections ||= {}
  @@connections[environment] ||= ::Sequel.connect({:logger => configuration.logger}.merge(::Rails::Sequel.configuration.environment_for(environment.to_s)))
  @@connections[environment]
end

.storageObject



19
20
21
# File 'lib/sequel-rails/storage.rb', line 19

def self.storage
  Storage
end