0

在我的本地開發環境中成功測試了我的「alpha」Rails 3應用程序後,我將其推到Heroku(Cedar)進行實時測試。推是成功的,但應用程序在啓動時崩潰,並顯示以下錯誤:

: => Booting WEBrick 
: => Ctrl-C to shutdown server 
: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require': /app/app/controllers/dives_controller.rb:50: invalid multibyte char (US-ASCII) (SyntaxError) 
: /app/app/controllers/dives_controller.rb:50: syntax error, unexpected $end 
: Exiting 

我已經檢查了意外的字符缺少結束語句,但似乎無法找到任何。我沒有使用任何多語言字符(據我所知)。

下面是我的一些文件,包括:Gemfile中,Gemfile.lock的,database.yml中,dives_controller.rb https://gist.github.com/2632041

難道這可能有些事情要使用Postgres的,而不是在我的數據庫specifiying它。 yml正確嗎?

+0

你使用的是數據庫嗎?如果是這樣,你需要在heroku上使用postgres。 – Dty

+1

您確定您在要點中上傳的DivesController版本與您上傳至Heroku的版本相同嗎? –

回答

2

如果你看看dives_controller.rblines 50 and 51,你會發現出現之前出現的一些奇怪的空白字符(它們在github輸出中突出顯示)。我有一種感覺是那些導致問題的角色。

他們可能已經通過按鍵盤上的一些隨機鍵錯誤地突然出現。只要刪除它們,並用space替換它們。

+0

謝謝。這正是問題所在。謝謝。 – Ryan

0

我也不清楚爲什麼這個工程,但我刪除了我的dives_controller.rb以下行和應用程序現在部署正確:

#@user = User.where(:facebook_id => current_user.identifier) 
#@dive = @user.dives.create(params[:dive]) 
#@dive = Dive.new(params[:dive]) 
0

Gist文件中以紅色突出顯示的空格是non-breaking spaces。對開發者來說是一場噩夢。
您可以要求您的IDE或文本編輯器以不同的字符顯示它們。

例如,set listchars=trail:◃,nbsp:•告訴VIM顯示•爲非中斷空格和◃爲尾部空格

相關問題