Module: Loaf::ControllerExtensions::ClassMethods

Defined in:
lib/loaf/controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

Add breacrumb to the trail in controller as class method


20
21
22
23
24
25
26
27
# File 'lib/loaf/controller_extensions.rb', line 20

def breadcrumb(name, url, options = {})
  normalizer = method(:_normalize_name)
  before_filter(options) do |instance|
    normalized_name = normalizer.call(name, instance)
    normalized_url  = normalizer.call(url, instance)
    instance.send(:breadcrumb, normalized_name, normalized_url, options)
  end
end