#viewのindex.html.erbにDBに入っているたくさんのuserのavatar情報を表示させたいと思っているのですがどうやってもエラーばかりで保存されている画像がviewに表示されません。
どなたかpaperclipに詳しい方教えてもらえると助かります。
top_controller.rb
class TopController < ApplicationController def index @evaluation = Evaluation.new @user = User.where.not(family_name: "田中" ).select(:family_name) @avatar = User.where.not(avatar: 1) #binding.pry #今はcurrent_userだがここをランダムな人の情報にしなければならない end end
index.html.erb
<div class="posting_form top_content"> <header class="posting_header"> <div class="posting_image icon_image" style="background-image: url(<%= current_user.avatar.url(:medium) %>);"></div> <div class="posting_user_info user_info"> <%= current_user.family_name %> <% @user.each do |user| %> <div class="profile_edit"> <%= user.family_name %> **ここにuserのavater情報を表示させたい** </div> <% end %> <%= current_user.family_name %> <div class="posting_image icon_image" style="background-image: url(<%= @avatar.url(:medium) %>);"></div> <% @user.each do |aaa| %> <div class="profile_edit"> <% end %> </div> </header> <%= form_for(@evaluation) do |f| %> <div class="field"> <div class="profile_edit"> <%= f.radio_button :rate, :so_good, checked: "checked" %> <%= f.label :so_good %> </div> <div class="profile_edit"> <%= f.radio_button :rate, :good %> <%= f.label :good %> </div> <div class="profile_edit"> <%= f.radio_button :rate, :bad %> <%= f.label :bad %> </div> <div class="profile_edit"> <%= f.radio_button :rate, :so_bad %> <%= f.label :so_bad %> </div> </div> <%= f.submit "評価する" %> <% end %> </div>
回答1件
あなたの回答
tips
プレビュー