Group_by for inbox

8 views
Skip to first unread message

Andrew Kelley

unread,
Mar 4, 2014, 1:55:18 PM3/4/14
to rubyonra...@googlegroups.com
How an I make the code below only show "no new messages" once rather
than multiple times when there are multiple tickets?


%tbody
- @users_tickets.each do |t|
- unless t.ticket_replies.empty?
%tr
%td= t.business.name
%td= link_to "#{t.contact.title}"+"("+
"#{t.ticket_replies.count}"+")", inbox_path(t)
%td
= h
distance_of_time_in_words_to_now(t.created_at,include_seconds =
true)
ago
- else
%b No new messages.

--
Posted via http://www.ruby-forum.com/.

James Davis, PhD

unread,
Mar 5, 2014, 8:06:36 AM3/5/14
to rubyonra...@googlegroups.com
Move the unless / if conditional statement outside of your do loop.

Reply all
Reply to author
Forward
0 new messages