オークションシステムに似たシステムを作っています。
下記のようにお知らせ一覧を実装したのですが、アクテビティだけではなく
運営からのお知らせやユーザへの個別メッセージも合わせて作るには
どういった設計にしたら良いでしょうか?
出品商品に質問があった場合などにお知らせするnotification model
・notification table
| originator | recipient | body_num | status |
・originatorはアクションを起こしたuser_id
・recipientはお知らせを受け取るuser_id
・body_numは対応する文言の数字
・statusは既読フラグ
lang
1#notification controller 2 3 def index 4 5 @notifications = Notification.where(recipient: current_user) 6 .order(created_at: :desc).includes(:item).includes(:navi) 7 .page(params[:page]).per(30) 8 9 #アクセスフラグ 10 @notifications.update_all({status: true}) 11 end 12 13 14 15#notification view 16<% if comment.body_num == 1 %> 17 <a href="<%= item_url(comment.item_id) %>" class="list-group-item"> 18  <i class="fa fa-comment-o"></i>  19 <small><%= comment.item.title%>出品アイテム<%= comment.item.title%>に質問がありました。</small> 20 <p class="palette-paragraph text-right"><%=date_format(comment.created_at) %></p> 21 </a> 22 <% end %> 23
あなたの回答
tips
プレビュー