Commit 9db0346a

mo k <m@mokhan.ca>
2011-08-16 03:24:31
display name of each creation that belongs to a category.
1 parent 62b0dd1
Changed files (2)
app
controllers
views
categories
app/controllers/categories_controller.rb
@@ -14,6 +14,7 @@ class CategoriesController < ApplicationController
   # GET /categories/1.xml
   def show
     @category = Category.where(:slug => params[:id])
+    @creations = Creation.joins(:categories).where(:categories => {:slug => params[:id]}).page(params[:page]).per(6)
 
     respond_to do |format|
       format.html # show.html.erb
app/views/categories/show.html.erb
@@ -5,10 +5,11 @@
   <%= @category.name %>
 </p>
 
-<p>
-  <b>Slug:</b>
-  <%# <%= @category.slug %>
-</p>
+<ul>
+<% @creations.each do |creation| %>
+  <li><%= creation.name %>
+<% end %>
+</ul>
 
 
 <%= link_to 'Edit', edit_category_path(@category) %> |