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

Parameters:

  • (String)


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

def breadcrumb(name, url, options = {})
  normalizer = method(:_normalize_name)
  send(_filter_name, 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