LoginSignup
0
0

More than 1 year has passed since last update.

メソッド、レシーバー(image)

Posted at
umarepo_show.html.erb

<%@cook.images.each do |image| %>
        <div class="cook_hoge">
        <div class="cook_image">
          <%= image_tag image %> 
        <% end %>

は、 <%= image_tag image %> でeachで回せる


<%@umarepos.each do |umarepo| %>
        <%umarepo.images.each do |image| %>
        <%= image_tag image %> 
        <% end %>
      <% end %>




@umareposには、Umarepoクラスのオブジェクトの配列がはいっる。
imagesというメソッドのレシーバはUmarepoクラスのオブジェクトじゃないといけない。
結果、@umareposの中からひとつづつ取り出して、
umaprepo.images
とする。




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0