Commit 5bf060ff

mo khan <mo@mokhan.ca>
2013-06-22 14:40:56
display tags on the creation tags page
1 parent 2eca070
Changed files (2)
app
app/controllers/tags_controller.rb
@@ -7,6 +7,6 @@ class TagsController < ApplicationController
     @tag = params[:id].downcase.gsub(/ /, '-')
     @total_tutorials = Tutorial.tagged_with(@tag).count
     @total_creations = Creation.tagged_with(@tag).count
-    @creations = Creation.includes(:user).tagged_with([@tag]).page(params[:page]).per(15)
+    @creations = Creation.includes([:user, :tags]).tagged_with([@tag]).page(params[:page]).per(15)
   end
 end
app/views/tags/show.html.erb
@@ -26,6 +26,11 @@
           <a href="<%= url_for creation %>"><img src="<%= creation.primary_image.image.large.url %>" /></a>
           <div class="caption">
             <h3><a href="<%= url_for creation %>"><%= creation.name %></a> <em><small>by <a href="<%= url_for profile_path(creation.user) %>"> <%= shrink(creation.user.name, 20) %></a></small></em></h3>
+            <p>
+            <% creation.tags.each do |tag| -%>
+              <a href="/t/<%= tag.name %>"><span class="label"><%= tag.name %></span></a>
+            <% end -%>
+            </p>
             <p><%= creation.story %></p>
             <p><a class="btn" href="<%= url_for creation %>">View</a></p>
           </div>