Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # find all submissions made by the current user, group by the
- # submission's :contest_year and :organization_id attributes:
- <% current_user.submissions.group([:contest_year, :organization_id]).each do |contest| %>
- <h2><%= contest.contest_year %>: <%= contest.organization.name %></h2>
- # here is where it fails, it is finding all the submissions made by the user
- # instead of just the submissions that belong under the
- # specified contest_year/organization_id heading from above.
- # I know I need 'contest' involved in here
- <% current_user.submissions.in_groups_of(3, false).each do |group| %>
- <div class="row">
- <% group.each do |submission| %>
- <div class="col-md-4">
- # submission information here
- </div>
- <% end %>
- </div><br/>
- <% end %>
- <% end %>
- Submission.rb
- belongs_to :user
- belongs_to :organization
- submissions_controller.rb
- def index
- @submissions = Submission.all
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement