Commit b7329674

mo khan <mo@mokhan.ca>
2014-11-01 05:04:57
add links to each tool used on the creation.
1 parent fd68d45
Changed files (2)
app
app/models/creation.rb
@@ -7,6 +7,7 @@ class Creation < ActiveRecord::Base
   has_many :favorites, :dependent => :destroy
   has_many :comments, dependent: :destroy
   acts_as_taggable_on :tags
+  acts_as_taggable_on :tools
   alias_method :author, :user
 
   default_scope -> { order(created_at: :desc) }
app/views/cakes/_show.html.erb
@@ -34,6 +34,14 @@
       </div>
       <% end %>
     </div>
+    <% if @creation.tools.any? %>
+      <p>Tools:</p>
+      <ul>
+      <% @creation.tools.each do |tool| -%>
+        <li><%= link_to tool.name, products_path(q: tool.name) %></li>
+      <% end -%>
+      </ul>
+    <% end -%>
     <p><%= render_markdown(@creation.story).html_safe -%></p>
   </div>
 </div>