Tasty breadcrumbs! Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.
Ruby Shell HTML CSS Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example Version 1.7.1 Apr 15, 2013
lib use ol instead of ul Feb 26, 2015
test fail tests, use ol Feb 26, 2015
.gitignore add possibility to add options to breadcrumb link May 7, 2013
.rvmrc Add .rvmrc Feb 26, 2013
.travis.yml All green against rails4! May 8, 2013
CHANGELOG Updated changelog for v1.8.0 Oct 20, 2013
Gemfile use https for rubygems Feb 26, 2015
MIT-LICENSE Updated copyright notice Jan 27, 2013
README.md use ol instead of ul Feb 26, 2015
Rakefile Add gem appraisal Apr 16, 2013
crummy.gemspec add missing development dependency Feb 26, 2015
init.rb Reworked gem file and code structure to make it load properly in Rails 3 Nov 23, 2010



Gem Version Build Status Code Climate

Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.


Simply add the dependency to your Gemfile:

gem "crummy", "~> 1.8.0"


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", '/'

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

  def load_comment
    @comment = Comment.find(params[:id])

Then in your view:

<%= render_crumbs %>

Html options for breadcrumb link

You can set the html options with link_html_options. These are added to the a tag.

add_crumb "Home", '/', link_html_options: {title: "my link title"}

##You can set html instead text in first parameter. If tag a present in this html, tag a not be a wrapper.

add_crumb "<a class='glyphicons shield' href='/support'><i></i>Support</a>".html_safe, "", {}

Options for render_crumbs

render_crumbs renders the list of crumbs as either html or xml

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 &raquo; for :html and <crumb> for :xml

separator: string

Render links in the output. Defaults to true

links: false

Render Richsnipet Default to false

microdata: true

Optionally disable linking of the last crumb, Defaults to true

last_crumb_linked: false

With this option, output will be blank if there are no breadcrumbs.

skip_if_blank: true


render_crumbs                     #=> <a href="/">Home</a> &raquo; <a href="/businesses">Businesses</a>
render_crumbs separator: ' | '    #=> <a href="/">Home</a> | <a href="/businesses">Businesses</a>
render_crumbs format: :xml        #=> <crumb href="/">Home</crumb><crumb href="/businesses">Businesses</crumb>
render_crumbs format: :html_list  #=> <ol class="" id=""><li class=""><a href="/">Home</a></li><li class=""><a href="/">Businesses</a></li></ol>
render_crumbs format: :html_list, :microdata => true
                                  #=> <ol class="" id=""><li class="" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
                                  #     <a href="/" itemprop="url"><span itemprop="title">Home</span></a></li></ol>
add_crumb support_link, {:right_side => true, :links => "/support", :li_right_class => "pull-right hidden-phone"}
                                  #=> <li class="pull-right hidden-phone">
                                  #=>  <span><a class="glyphicons shield" href="/support">
                                  #=>   <i></i>Support</a>
                                  #=>  </span>
                                  #=> </li>
                                  #=> <li class="divider pull-right hidden-phone"></li>

A crumb with a nil argument for the link will output an unlinked crumb.

With format: :html_list you can specify additional params: :li_class, :ol_class, :ol_id

App-wide configuration

You have the option to pre-configure any of the Crummy options in an application-wide configuration. The options above are available to configure, with the exception of :separator, as well as many others.

The biggest difference is that :separator is not an option. Instead, you have format-specific configuration options: :html_separator, :xml_separator, and :html_list_separator. :separator can still be overridden in the view.

Insert the following in a file named config/initializers/crummy.rb:

Crummy.configure do |config|
  config.format = :xml

Possible parameters for configuration are:


See lib/crummy.rb for a list of these parameters and their defaults.

###Individually for each crumb configuration:

add_crumb support_link, {:right_side => true, :links => "/support", : li_class => "my_class", :li_right_class => "pull-right hidden-phone"}

Simple add that parameter to options hash.

Live example application

An example application is available right inside this gem. That application is documented, see example/README for details about usage.


  • Accept collections of models as a single argument
  • 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)
  • Make a crumbs? type method


Copyright 2008-2013 Zach Inglis, released under the MIT license