ActiveRecord代码库中的哪一行(或方法)是否加载了Rails应用程序的config /
database.yml? (我具体看4.0.5,但是如果有人有关于> = 4.0.5的任何信息,那会很有启发性)?
解决方法
它位于Railties中,特别是在第101-116行的文件railties / lib / rails / application / configuration.rb中(对于Rails 4.0.5):
https://github.com/rails/rails/blob/v4.0.5/railties/lib/rails/application/configuration.rb#L101-L116
# Loads and returns the configuration of the database. def database_configuration yaml = paths["config/database"].first if File.exist?(yaml) require "erb" YAML.load ERB.new(IO.read(yaml)).result elsif ENV['DATABASE_URL'] nil else raise "Could not load database configuration. No such file - #{yaml}" end rescue Psych::SyntaxError => e raise "YAML Syntax error occurred while parsing #{paths["config/database"].first}. " \ "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ "Error: #{e.message}" end
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。