Skip to content
Browse files

environment keys symbol and string confusion

  • Loading branch information...
1 parent 18abe6b commit e3f8d998fd0d374495ed874386db37986503b2ad @brasten committed May 18, 2010
Showing with 5 additions and 1 deletion.
  1. +4 −0 lib/sequel-rails/configuration.rb
  2. +1 −1 lib/sequel-rails/setup.rb
View
4 lib/sequel-rails/configuration.rb
@@ -16,6 +16,10 @@ def self.for(root, database_yml_hash)
attr_accessor :logger
attr_accessor :migration_dir
+ def environment_for(name)
+ environments[name.to_s] || environments[name.to_sym]
+ end
+
def environments
@environments ||= @raw.inject({}) do |normalized, environment|
name, config = environment.first, environment.last
View
2 lib/sequel-rails/setup.rb
@@ -11,7 +11,7 @@ module Sequel
def self.setup(environment)
puts "[sequel] Setting up the #{environment.inspect} environment:"
- ::Sequel.connect({:logger => configuration.logger}.merge(::Rails::Sequel.configuration.environments[environment.to_s]))
+ ::Sequel.connect({:logger => configuration.logger}.merge(::Rails::Sequel.configuration.environment_for(environment.to_s)))
end
end

0 comments on commit e3f8d99

Please sign in to comment.
Something went wrong with that request. Please try again.