html - An image does't show up on my local server in Rails -


i'm trying show image(lady enjoy.png) set on image file in asset file does't appear. think codes correct though.

<article class="project2">   <div class="media">     <a href="#">       <img src="<% asset_path "ladyenjoy.jpg" %>" alt="" title="">     </a>   </div>   <div class="details">     <a href="work_details.html">       <h1>enjoy it!</h1>     </a>     <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo ...</p>   </div> </article> 

you not need execute code, put there well, , in case need equal(=) sign there.

<%= asset_path "ladyenjoy.jpg" %> 

<% %> execute code, didn't print/put html file. in case, if return form execution returned result method asset_path, need use <%= %>.

edit:

for doing, better use image_tag instead of asset_path. image_tag needs name of image, , gonna take care of rest of things.

<%= image_tag 'ladyenjoy.jpg' %> 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -