Skip to content
Todd Baur edited this page Jan 26, 2018 · 5 revisions

Notice If your application is using breadcrumbs-on-rails and Railsstrap v3 you will have a namespace collision with the add_breadcrumb method. You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.

Add breadcrumbs helper <%= render_breadcrumbs %> to your layout. You can also specify a divider for it like this: <%= render_breadcrumbs('>') %> (default divider is /).

Full example:

render_breadcrumbs(" / ", { :class => '', :item_class => '', :divider_class => '', :active_class => 'active' })
class ApplicationController
  add_breadcrumb :root # 'root_path' will be used as url
end
class ExamplesController < ApplicationController
  add_breadcrumb :index, :examples_path

  def edit
    @example = Example.find params[:id]
    add_breadcrumb @example # @example.to_s as name, example_path(@example) as url
    add_breadcrumb :edit, edit_example_path(@example)
  end
end

All symbolic names translated with I18n. See I18n Internationalization Support section.

Important In Railsstrap 4.0+ the render_breadcrumbs method is simply breadcrumbs.

Padrino and Middleman are not supported because those frameworks provide breadcrumbs.