<img src=“
” alt=“Gem Version” /> <img src=“
” /> <img src=“travis-ci.org/museways/crumbs.png?branch=master” alt=“Build Status” /> <img src=“
” alt=“Dependency Status” />
Crumbs
Adds a handy crumbs variable available in your views.
Install
Put this line in your Gemfile:
gem 'crumbs'
Then bundle:
$ bundle
Usage
In your controllers add crumbs to the actions you want to have a crumb:
crumb :home, 'Home'
You can use a lambda, proc or block too, will receive the corresponding url parameters:
crumb :product, proc { |params| Product.find(params[:id]).name }
Then in your views would be available a crumbs variable:
<% @crumbs.each do |crumb| %>
> <%= link_to crumb[:name], crumb[:path] %>
<% end %>
Configuration
If you want to show the last crumb, put this in your application.rb:
config.crumbs.show_last = true