当无法建立到数据库的连接时引发此错误,原因可能是无法连接到主机或授权失败。
方法
- H
- N
- U
类公共方法
hostname_error(hostname) 链接
源代码:显示 | 在GitHub上查看
# File activerecord/lib/active_record/errors.rb, line 108 def hostname_error(hostname) DatabaseConnectionError.new(<<~MSG) There is an issue connecting with your hostname: #{hostname}.\n Please check your database configuration and ensure there is a valid connection to your database. MSG end
new(message = nil) 链接
源代码:显示 | 在GitHub上查看
# File activerecord/lib/active_record/errors.rb, line 103 def initialize(message = nil) super(message || "Database connection error") end
username_error(username) 链接
源代码:显示 | 在GitHub上查看
# File activerecord/lib/active_record/errors.rb, line 115 def username_error(username) DatabaseConnectionError.new(<<~MSG) There is an issue connecting to your database with your username/password, username: #{username}.\n Please check your database configuration to ensure the username/password are valid. MSG end