Skip to content

Commit

Permalink
update to parse database.yml through erb
Browse files Browse the repository at this point in the history
  • Loading branch information
rgarver committed Jun 30, 2008
1 parent 2ecc092 commit ea6a859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/use_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_use_db_conn_spec(options)
return options
else
str = "#{prefix}#{rails_env}#{suffix}"
connections = YAML.load(File.read "#{RAILS_ROOT}/config/database.yml")
connections = YAML.load(ERB.new(IO.read("#{RAILS_ROOT}/config/database.yml")).result)
raise "Cannot find database specification. Configuration '#{str}' expected in config/database.yml" if (connections[str].nil?)
return connections[str]
end
Expand Down
2 changes: 1 addition & 1 deletion test/use_db_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class UseDbTest < Test::Unit::TestCase
# Replace this with your real tests.
def test_this_plugin
def test_it_will_get_the_right_connection
flunk
end
end

0 comments on commit ea6a859

Please sign in to comment.