gpt4 book ai didi

ruby-on-rails - rails 找不到 database.yml

转载 作者:行者123 更新时间:2023-12-04 02:50:55 24 4
gpt4 key购买 nike

我刚刚删除了我的 database.yml因为我正在尝试使用 Mongoid,现在我得到以下信息:

$ rails server           
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application/configuration.rb:88:in `read': No such file or directory - /home/chris-kun/code/thirsty/config/database.yml (Errno::ENOENT)
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application/configuration.rb:88:in `database_configuration'
from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/railtie.rb:58:in `block (2 levels) in <class:Railtie>'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/railtie.rb:57:in `block in <class:Railtie>'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /home/chris-kun/code/thirsty/config/environment.rb:5:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /home/chris-kun/code/thirsty/config.ru:3:in `block in <main>'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/chris-kun/code/thirsty/config.ru:1:in `new'
from /home/chris-kun/code/thirsty/config.ru:1:in `<main>'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
1 #!/usr/bin/env ruby
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/server.rb:65:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

有任何想法吗?

最佳答案

config/application.rb ,删除行 require 'rails/all'并替换为:

require "rails"

%w(
action_controller
action_mailer
active_resource
rails/test_unit
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end

(这是 railties gem 中 rails/all.rb 的内容,但删除了 activerecord 行)。

关于ruby-on-rails - rails 找不到 database.yml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6420131/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com