Replace
= breadcrumb :root
= breadcrumbs pretext: "You are here: ", separator: " › "
with
- breadcrumb :root
= breadcrumbs pretext: "You are here: ", separator: " › "
質問
So I'm setting up a basic Gretel installation following instructions in https://github.com/lassebunk/gretel.
This is my breadcrumb.rb
crumb :root do
link 'Root', root_path
end
And this is the code within the show.html.haml (My views are coded in haml)
= breadcrumb :root
And the application.html.haml
= breadcrumbs pretext: "You are here: ", separator: " › "
Now the rendering I got is something like
Any idea what could be going wrong? I was expecting a breadcrumb with the test 'Root'
解決
Replace
= breadcrumb :root
= breadcrumbs pretext: "You are here: ", separator: " › "
with
- breadcrumb :root
= breadcrumbs pretext: "You are here: ", separator: " › "
他のヒント
I was facing the same issue, the only problem in our case that we are trying to see breadcrumbs even for root page.
According to the gem wiki the parameter ":display_single_fragment" is set to false by default. The Parameter is quite self-explanatory.
The code below works as expected:
- breadcrumb :portfolios
= breadcrumbs pretext: "You are here: ", separator: " › ", :autoroot => true, :display_single_fragment => true
for link single link you have to "display_single_fragment" attribute to true in application controller
<%= breadcrumbs pretext: "current link", display_single_fragment: "true" %>
Change
= breadcrumb :root
to
- breadcrumb :root
Hope it helps.