maryanne maryanne - 2 months ago 6
CSS Question

Logo does not show up on every page

I've set a logo for my rails application and it shows up on every static page. But if I sign in, the newly created link

users/1
does not display it anymore,the same with
users/index
.
Here's my
_header.html.erb
:

<header class="navbar navbar-fixed-top navbar-inverse">
<div class="containers">
<a href='/'><img src="image1.png" alt='image'></a>
<%= link_to "Cherry Pie", root_path, id: "logo" %>
</div>
</header>


The logo is now located in
assets/images
folder. I tried to move it into
public
folder but nothing changed. How can I make it show the same way on every page?

Answer

If the image in the public folder you can use image_tag for view on every page ;

<%= image_tag "/../image1.png" %>

More about image_tag here.

Comments