Skip to content

Instantly share code, notes, and snippets.

@tmaeda
Last active December 14, 2016 06:38
Show Gist options
  • Save tmaeda/eec89c90bcff9f4d3b4b198563148029 to your computer and use it in GitHub Desktop.
Save tmaeda/eec89c90bcff9f4d3b4b198563148029 to your computer and use it in GitHub Desktop.
今、どこのDBにつながっているかを pry のプロンプトに表示する
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