2014-09-04 63 views
-1

我已经开始使用和学习Ruby on Rails的,我想用的sqlite3的的Postgres而是一堆东西后,我经历了安装宝石(我使用红宝石 2.1.2和Rails的 4.1 的Ubuntu 14.04)当我运行Rails的创建我欢迎索引页后,我得到这个错误:RunTimeError:YAML语法错误(未知)

YAML syntax error occurred while parsing /home/charlie/Documents/Projects/@potsuri/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error:(): found character that cannot start any token while scanning for the next token at line 26 column 13

这是我在第26行第13列

database: @potsuri_development 

这是从24行到第26行

development: 

< <:*默认 数据库:@potsuri_development

我m新使用Postgres所以我不知道如何解决这个“语法错误”。

+0

你能显示所有的database.yml内容吗? – pangpang 2014-09-04 01:33:34

回答

1

我不认为这有什么关系的Postgres,而相反YAML/红宝石

我想通过它的外观,你已经得到了你想要插值到YAML文件红宝石类的实例变量?我认为问题是纯YAML不知道任何关于红宝石,所以语法(特别是@)不是预期的。

@字符在YAML保留,所以如果你能够逃脱它,也就是\@,它可能会在它读成文字@字符,但可能不会插它。

如果您 YAML 文件是在ERB嵌入的Ruby)上下文,你要插值存在变量,装载然后使用嵌入的Ruby可能工作,让您的在那里值,即

database: <% @potsuri_development %> 

注意:我没有downvote你的问题。