Jermaine Subia
Jermaine Subia

Reputation: 796

Unable to launch rails in production environment locally - Rails 5

This is my first time launching a rails app in a production environment. I first ran rails server -e production then had to get the secret key. Afterwards I ran this line bundle exec rake assets:precompile db:migrate RAILS_ENV=production. Once I ran that line I ran rails server -e production one more time I got the following error in my terminal (See last 4 lines) along with the 404 error page in my browser:

krav@krav-Q534UXK:~/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

When I go to the lines that are giving an error here they are respectively:

Line 20

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

Line 107

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

In development this works fine. I cannot figure out why these lines are giving me an error and not allowing the web app to launch they look right and got me the look I needed when I was in development mode.

error image

Upvotes: 1

Views: 147

Answers (1)

dstull
dstull

Reputation: 338

The lines have duplicate key of data in them and should only have one:

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

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

Upvotes: 1

Related Questions