请求 ruby-on-rails 应用程序会出现 Psych::BadAlias 错误 [英] Requesting a ruby-on-rails application gives Psych::BadAlias error
问题描述
我从我的应用程序目录运行了 rails 服务器.但是当我尝试使用
I ran the rails server from my application directory. But when I tried to do a request from the browser with
http://localhost:3000
我收到以下错误:
*Psych::BadAlias
*Psych::BadAlias
无法加载Rails.application.database_configuration
:未知别名:默认*
Cannot load Rails.application.database_configuration
: Unknown alias: default*
推荐答案
发生这种情况是因为 netbeans 的 ruby-plugin 在从现有源创建项目时弄乱了 database.yml 文件.它将关于 sqlite3 的注释替换为 mysql,但更糟糕的是它删除了第一个定义块,即默认"
This happens because the ruby-plugin for netbeans messes the database.yml file when creating project from existing source. It replaces the comment about sqlite3 to mysql, but even worse it erases the first definition block which is 'default'
所以只需插入
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
在 database.yml 的开头,你会没事的
at the beginning of the database.yml and you'll be fine
这篇关于请求 ruby-on-rails 应用程序会出现 Psych::BadAlias 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!