lib/crumbs/action_controller/base.rb in crumbs-1.0.7 vs lib/crumbs/action_controller/base.rb in crumbs-1.0.8
- old
+ new
@@ -61,11 +61,11 @@
session[:referer] = [{ base_url: request.base_url, path: request.path, fullpath: request.fullpath }]
end
def join_parts(parts)
path = parts.join('/')
- (path[0] != '/' ? "/#{path}" : path)
+ path[0] != '/' ? "/#{path}" : path
end
def is_last_referer?
last = session[:referer].last
last[:base_url] == request.base_url and last[:path] == request.path
@@ -107,11 +107,12 @@
module ClassMethods
protected
- def crumb(action, name)
+ def crumb(action, name = nil, &block)
controller = self.name.gsub('::', '/').gsub('Controller', '').underscore
+ name = block_given? ? block : name
History.add(controller, action, name)
end
end
end