Skip to content

Instantly share code, notes, and snippets.

@Random-Stack-Random-Day
Created November 29, 2016 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Random-Stack-Random-Day/af849870ba3edb216bfdd8086d71ffcb to your computer and use it in GitHub Desktop.
Save Random-Stack-Random-Day/af849870ba3edb216bfdd8086d71ffcb to your computer and use it in GitHub Desktop.
<% provide(:title, @user.name) %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<h1>
<%= gravatar_for @user %>
<%= @user.name %><br>
</h1>
</section>
</aside>
<div class="collectionList">
<% @user.collections.each do |d| %>
<div class="collectionSample">
<strong><%= link_to d.name, {:controller => "collections", :action => "show", :id => d.id } %></strong><br />
Distinct Cards: <%= d.card_collections.count %> <br />
Total Cards:
<% d.card_collections.each do |x| %>
<% y = [] %>
<% y << x.card_counts %>
<% y.flatten! %>
<% y = y.inject(0){|sum,x| sum + x } %>
<%= y %>
<% end %>
<% if d.public %> Public <% end %><br />
</div>
<% end %>
</div>
</div>
@aruprakshit
Copy link

Total Cards: <%= d.card_collections.sum(:card_counts) %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment