-
-
Notifications
You must be signed in to change notification settings - Fork 998
Breadcrumbs Helper
toadkicker edited this page Sep 22, 2014
·
2 revisions
Notice If your application is using breadcrumbs-on-rails 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.