2014-09-04 61 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你的問題。