2013-02-11 81 views
1

民間,Actionview ::模板::錯誤與條紋時推送到Heroku

我試圖在Heroku上使用條紋部署rails webapp。這可能是預編譯資產問題。我檢查了heroku錯誤日誌,並且有一個actionview模板錯誤「undefined method stripe」

一切工作正常我的本地機器上,它只是推動到heroku時出錯。

2013-02-11T00:22:53+00:00 app[web.1]: ActionView::Template::Error (undefined method `stripe' for #<Rails::Application::Configuration:0x00000003397440>): 
    2013-02-11T00:22:53+00:00 app[web.1]:  7: 
    2013-02-11T00:22:53+00:00 app[web.1]:  6: </article> 
    2013-02-11T00:22:53+00:00 app[web.1]:  9:   data-key="<%= Rails.configuration.stripe[:publishable_key] %>" 
    2013-02-11T00:22:53+00:00 app[web.1]:  8: <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" 
    2013-02-11T00:22:53+00:00 app[web.1]:  10:   data-description="You'll get your information in 2 days!" 

希望有人對此問題有所瞭解。我試着下載完整的stripe.js文件並將其放入我的資產文件夾中,但這似乎沒有幫助。

回答

1

這似乎與資產編制或stripe.js有關。這是在您的視圖中失敗的行:

data-key="<%= Rails.configuration.stripe[:publishable_key] %>" 

Heroku用您的生產環境設置運行您的應用程序。是否有可能在development.rb中設置了Rails.configuration.stripe,或者其他類似的地方?

1

我有同樣的問題,但這是因爲當我第一次開發測試Stripe時,我在我的stripe.rb文件中有實際的密鑰,所以我將它添加到我的.gitignore以避免版本化這些密鑰。當更新我的代碼在生產環境中運行時,我使用ENV變量,但忘記從.gitignore中刪除stripe.rb。仔細檢查以確保您重新配置變量,停止忽略文件,並且應該設置。

+0

這是爲我:stripe.rb在我的.gitignore。感謝您分享您的個人經驗,非常感謝! – DnfD 2014-04-18 05:58:52