Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

crummy

> 编程语言
Open source

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

353 stars0 likes4 views
WebsiteGitHub

About

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

Warning This is no longer maintained and hasn't been for quite some time. I no longer spend any time in the Ruby world. If you would like to maintain it, do reach out and ask.

Crummy

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

Install

Simply add the dependency to your Gemfile:

ruby
gem "crummy", "~> 1.8.0"

Example

In your controllers you may add_crumb either like a before_filter or within a method (It is also available to views).

ruby
class ApplicationController
  add_crumb "Home", '/'
end

class BusinessController 

Html options for breadcrumb link

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

ruby
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.

ruby
add_crumb "Support".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

ruby
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 `` for :xml

ruby
separator: string

Render links in the output. Defaults to true

ruby
links: false

Render Richsnipet Default to false

ruby
microdata: true

Optionally disable linking of the last crumb, Defaults to true

ruby
last_crumb_linked: false

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

ruby
skip_if_blank: true

Examples

…

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:

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

Possible parameters for configuration are:

ruby
:format
:links
:skip_if_blank
:html_separator
:xml_separator
:html_list_separator
:html_list_right_separator
:first_class
:last_class
:ol_id
:ol_class
:li_class
:li_right_class
:microdata
:last_crumb_linked
:truncate
:right_side

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

###Individually for each crumb configuration:

ruby
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.

Todo

  • 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

Credits

  • Zach Inglis of Superhero Studios
  • Andrew Nesbitt
  • Rein Henrichs
  • Les Hill
  • Sandro Turriate
  • Przemysław Kowalczyk
    • feature ideas
  • Sharad Jain
  • Max Riveiro
  • Kamil K. Lemański
  • Brian Cobb
  • Kir Shatrov (Evrone company)
  • sugilog
  • Trond Arve Nordheim
  • Jan Szumiec
  • Jeff Browning
  • Bill Turner

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言