method
config
v5.2.3 -
Show latest stable
- Class:
Rails::DBConsole
config()public
No documentation available.
# File railties/lib/rails/commands/dbconsole/dbconsole_command.rb, line 90
def config
@config ||= begin
# We need to check whether the user passed the connection the
# first time around to show a consistent error message to people
# relying on 2-level database configuration.
if @options["connection"] && configurations[connection].blank?
raise ActiveRecord::AdapterNotSpecified, "'#{connection}' connection is not configured. Available configuration: #{configurations.inspect}"
elsif configurations[environment].blank? && configurations[connection].blank?
raise ActiveRecord::AdapterNotSpecified, "'#{environment}' database is not configured. Available configuration: #{configurations.inspect}"
else
configurations[environment].presence || configurations[connection]
end
end
end