h1. Crummy h2. Introduction Crummy is a simple and tasty way to add breadcrumbs to your Rails applications. h2. Install Simply add the dependency to your Gemfile:
  
    gem "crummy", "~> 1.3"
  
h3. Rails 2 In your terminal, write:
  
    gem install crummy
  
h2. Example In your controllers you may add_crumb either like a before_filter or within a method (It is also available to views).
  
    class ApplicationController
      add_crumb "Home", '/'
    end

    class BusinessController < ApplicationController
      add_crumb("Businesses") { |instance| instance.send :businesses_path }
      add_crumb("Comments", :only => "comments") { |instance| instance.send :businesses_comments_path }
      before_filter :load_comment, :only => "show"
      add_crumb :comment, :only => "show"

      # Example for nested routes:
      add_crumb(:document) { [:account, :document] }

      def show
        add_crumb @business.display_name, @business
      end

      def load_comment
        @comment = Comment.find(params[:id])
      end
    end
  
Then in your view:
  
    <%= render_crumbs %>
  
h2. Options for render_crumbs render_crumbs renders the list of crumbs as either html or xml It takes 3 options The output format. Can either be :xml or :html or :html_list. Defaults to :html :format => (:html|:html_list|:xml) The separator text. It does not assume you want spaces on either side so you must specify. Defaults to » for :html and for :xml :separator => string Render links in the output. Defaults to +true+ :links => boolean :skip_if_blank => true With this option, output will be blank if there are no breadcrumps. h3. Examples
 
  render_crumbs                        #=> Home » Businesses
  render_crumbs :separator => ' | '    #=> Home | Businesses
  render_crumbs :format => :xml        #=> HomeBusinesses
  render_crumbs :format => :html_list  #=> 
 
A crumb with a nil argument for the link will output an unlinked crumb. With :format => :html_list you can specify additional params: :active_li_class, :li_class, :ul_class, :ul_id h2. Notes h2. Todo * Port over rspecs from project to plugin (Fully tested in a project) * Accept instances of models as a single argument * Allow for variables in names. (The workaround is to do your own before_filter for that currently) h2. Credits * "Zach Inglis":http://zachinglis.com of "London Made":http://londonmade.co.uk * "Rein Henrichs":http://reinh.com * "Les Hill":http://blog.leshill.org/ * "Sandro Turriate":http://turriate.com/ * "Przemysław Kowalczyk":http://szeryf.wordpress.com/2008/06/13/easy-and-flexible-breadcrumbs-for-rails/ - feature ideas * "Sharad Jain":http://github.com/sjain * "Max Riveiro":http://github.com/kavu * "Kamil K. Lemański":http://kml.jogger.pl * "Brian Cobb":http://bcobb.net/ * "Kir Shatrov":http://shatrov.tk/ * "sugilog":http://github.com/sugilog * "Trond Arve Nordheim":http://github.com/tanordheim *Copyright (c) 2008-2011 Zach Inglis, released under the MIT license*