lib/crumbs/action_controller/base.rb in crumbs-1.1.2 vs lib/crumbs/action_controller/base.rb in crumbs-1.2.0
- old
+ new
@@ -20,11 +20,11 @@
elsif index = find_referer_index(paths)
session[:referers] = session[:referers][0...index] + [referer]
elsif
session[:referers] = [referer]
end
- paths.pop unless Rails.application.config.crumbs.show_last
+ paths.pop unless Crumbs.config.show_last
@crumbs = []
paths.each do |path|
params = Rails.application.routes.recognize_path("#{request.base_url}#{path}") rescue next
if name = Crumbs::Definitions.find(params[:controller], params[:action], params)
if index = find_referer_index(path)
@@ -37,20 +37,18 @@
def find_referer_index(paths)
paths = [paths] unless paths.is_a? Array
session[:referers].rindex { |referer| paths.include? referer[:path] }
end
-
+
module ClassMethods
-
+
protected
-
+
def crumb(action, name=nil, &block)
- controller = self.name.gsub('::', '/').gsub('Controller', '').underscore
- name = block_given? ? block : name
- Crumbs::Definitions.add controller.to_s, action.to_s, name
+ Crumbs::Definitions.add controller_path, action.to_s, (block_given? ? block : name)
end
-
+
end
end
end
end