I am newbie with Rails and trying to display photos to my homepage and here is my code at my home.html.erb
<br/>
<div class="row">
<% @courses.each do |course| %>
<div class="col m4">
<div class="card">
<div class="card-image">
<%= link_to course do %>
<%= image_tag "courses/#{course.image}" %>
<% end %>
</div>
<div class="card-content">
<span class="card-title"><%= course.title %></span>
<% (1..course.star).each do %>
<1 class="material-icons" green-text>grade</i>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
I made another page named "course" to upload photo to the homepage. Then, when I ran the code, it said to me that at the line <%= image_tag "courses/#{course.image}" %>
there was an error. The asset "courses/image1" is not present in the asset pipeline.
Here is what I did.
First, I went to app/assets/images.
Second, I made folder which named "photos".
Third put image to the folder "photos". And Last I tried the code but there was the error.
Could you please give me some ideas? Thank you very much.
Aucun commentaire:
Enregistrer un commentaire