Reputation:
My images not showed in production (link here).
My code:
<%if action_name == 'index' %>
<div class="main_header_bg" id="main_head">
<% end %>
<header id='header'>
<div class="container">
<div class="logo">
<%= link_to image_tag('logo.png'), root_path%>
</div>
.main_header_bg {
background-image: url(/header_bg.jpg);
-webkit-background-size: 100% 100%;
background-size: 100% 100%;
height: 718px;
ActionController::RoutingError (No route matches [GET] "/assets/images/header_bg.jpg"):
Images directories:
Upvotes: 1
Views: 55
Reputation: 1665
Did you precompile your assets? Explicitly in the production environment? This is a very typical issue to run into with people that are pushing Rails projects into production for the first time.
If not, run the following: RAILS_ENV=production bundle exec rake assets:precompile
Remember that actual files are being written here and you'll need to re-upload your application for the changes to take effect.
Upvotes: 1
Reputation: 10406
It's probably because of the asset pipeline
.main_header_bg {
background-image: image-url("header_bg.jpg");
-webkit-background-size: 100% 100%;
background-size: 100% 100%;
height: 718px;
}
So change url
to image-url
and precompile and restart the site.
Upvotes: 0