#---
# Excerpted from "Rails Recipes"
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/fr_rr for more book information.
#---
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def recipe_link(recipe)
    link_to "#{recipe.name} (#{recipe.comments.count})", 
            {  :controller => 'recipes', 
               :action => 'show', 
               :id => recipe}, 
            :class => "recipe-link#{recipe.comments.count > 0 ? '-with-comments' : ''}"
  end
end
