lib/rails_crumbs/controller.rb in rails_crumbs-0.0.2 vs lib/rails_crumbs/controller.rb in rails_crumbs-1.0.0
- old
+ new
@@ -1,9 +1,17 @@
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 ||= []
@@ -12,9 +20,10 @@
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
\ No newline at end of file