2017-09-01 84 views
1

这是我第一次在生产环境中启动rails应用程序。我第一次运行rails server -e production,然后必须得到密钥。之后我跑了这条线bundle exec rake assets:precompile db:migrate RAILS_ENV=production。有一次,我跑这条线我跑rails server -e production一次我在终端得到了以下错误(见最后4行),在浏览器中的404错误页面沿:无法在本地生产环境中启动rails - Rails 5

[email protected]:~/Desktop/cnd$ rails server -e production 
=> Booting Puma 
=> Rails 5.1.3 application starting in production on http://0.0.0.0:3000 
=> Run `rails server -h` for more startup options 
Puma starting in single mode... 
* Version 3.10.0 (ruby 2.3.3-p222), codename: Russell's Teapot 
* Min threads: 5, max threads: 5 
* Environment: production 
* Listening on tcp://0.0.0.0:3000 
Use Ctrl-C to stop 
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20 
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20 
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107 
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107 

当我去是行这里给了一个错误,他们分别是:

线20

<%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %> 

线107

<%= image_tag "AdobeStock_108067927.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %> 

在开发中,这工作正常。我无法弄清楚为什么这些行给我一个错误,并且不允许Web应用程序启动,他们看起来是正确的,并让我看到我在开发模式时需要的外观。

error image

回答

1

线具有在其中数据的重复键和应该只有一个:

即此: <%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>

应该是这样的:<%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom",bgrepeat: "no-repeat", bgfit: "cover"} , :class => "rev-slidebg" %>

相关问题