RubyOnRails Breadcrumb Helper
I needed a stupid simple breadcrumb helper that was fast and didn’t require crazy configuration. I don’t need a high level of control, so I figured, lets just take the requested path and link the segments, and here we have it.
1 2 3 4 5 6 7 8 | def breadcrumbs(separator = ' > ', options = {}) (crumbs, previous) = [], [] request.path.split('/').each do |part| previous << part crumbs << link_to(part, previous.join('/'), options) end crumbs.join(separator) end |
Feel free to leave feedback.
















