Skip to content

Commit

Permalink
Fix build failures related to the new ENV options in yml
Browse files Browse the repository at this point in the history
  • Loading branch information
José Valim committed Dec 24, 2013
1 parent 222f00b commit d8336ca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def resolve_env_connection(spec) # :nodoc:
# an environment key or a url spec. So we support both for
# now but it would be nice to limit the environment key only
# for symbols.
spec = configurations.fetch(spec.to_s) do
config = configurations.fetch(spec.to_s) do
resolve_string_connection(spec) if spec.is_a?(String)
end
raise(AdapterNotSpecified, "#{spec} database is not configured") unless spec
resolve_connection spec
raise(AdapterNotSpecified, "#{spec} database is not configured") unless config
resolve_connection config
end

def resolve_hash_connection(spec) # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Railtie < Rails::Railtie # :nodoc:
resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(configuration)

configuration.each do |key, value|
configuration[key] = resolver.resolve(value) if value
configuration[key] = resolver.resolve(value).config.stringify_keys if value
end

ActiveRecord::Tasks::DatabaseTasks.database_configuration = configuration
Expand Down
18 changes: 18 additions & 0 deletions railties/test/isolation/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,24 @@ def build_app(options = {})
end
end

File.open("#{app_path}/config/database.yml", "w") do |f|
f.puts <<-YAML
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
YAML
end

add_to_config <<-RUBY
config.eager_load = false
config.session_store :cookie_store, key: "_myapp_session"
Expand Down

0 comments on commit d8336ca

Please sign in to comment.