module RailsCrumbs module RailsCrumbsController def set_railscrumb(name, path, options = {}) case path when Symbol path = self.send(path) when Proc path = path.call(self) else path = self.url_for(path) end self.railscrumbs << Crumb.new(name, path, options) end def railscrumbs @railscrumbs ||= [] end def self.included(base) base.send(:extend, ClassMethods) end module ClassMethods def set_railscrumb(name, path = nil, options = {}) only = options.delete(:only){ [] } if only.empty? filter_options = {} else filter_options = {:only => only} end before_filter(filter_options) do |controller| controller.send(:set_railscrumb, name, path, options) end end end end end