Last active
December 14, 2016 06:38
-
-
Save tmaeda/eec89c90bcff9f4d3b4b198563148029 to your computer and use it in GitHub Desktop.
今、どこのDBにつながっているかを pry のプロンプトに表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pry.config.prompt = proc do |obj, nest_level, _pry_| | |
db = '' | |
if defined? Rails | |
db << '%s:%s/%s' % Rails.configuration.database_configuration[Rails.env].values_at('host', 'port', 'database') | |
end | |
"#{Pry.config.prompt_name}(#{Pry.view_clip(obj)}) #{db}> " | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment