Aug 26

If you want to put breadcrumbs in your rails application, please have a look “Crummy” Plugin.

This is a simple breadcrumbs, and no javascript library required.

You can install it by type :

ruby script/plugin install git://github.com/zachinglis/crummy.git

How to use :

1. In your controller you may add_crumb either like a before_filter or within a method.

Example :

class ApplicationController

add_crumb “Home”, ‘/’

end

class BusinessController < ApplicationController

add_crumb(”Businesses”) { |instance| instance.send :businesses_path }

add_crumb(”Comments”,

:only => “comments”) {|instance| instance.send :businesses_comments_path}

before_filter :load_comment, :only => “show”

add_crumb :comment, :only => “show”

def show

add_crumb @business.display_name, @business

end

def load_comment

@comment = Comment.find(params[:id])

end

end

2. Then in your view (you can put it in \layout\application.html.erb) :

<%= render_crumbs %>

3. Finally, in your website you could see the breadcrumbs like this :

Home >> Businesses

You can change the separator text : <%= render_crumbs :seperator => ‘ | ‘ %>

For more detail please have a look :

http://github.com/zachinglis/crummy/tree/master

Leave a Reply

Security Code: