views:

289

answers:

1

I want to display the current host and database names in a view.

Where can I get these names?

Are there some predefined environment or global variables?

+8  A: 

You can create a rails configuration object and obtain the necessary information from it:

config   = Rails::Configuration.new
host     = config.database_configuration[RAILS_ENV]["host"]
database = config.database_configuration[RAILS_ENV]["database"]

See the documentation for Rails::Configuration for details.

Robert Gamble