Module: BreadcrumbsOnRails::ActionController::ClassMethods

Defined in:
lib/breadcrumbs_on_rails/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#add_breadcrumb(name, path = nil, filter_options = {}) ⇒ Object


67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/breadcrumbs_on_rails/action_controller.rb', line 67

def add_breadcrumb(name, path = nil, filter_options = {})
  # This isn't really nice here
  if eval = Utils.convert_to_set_of_strings(filter_options.delete(:eval), %w(name path))
    name = Utils.instance_proc(name) if eval.include?("name")
    path = Utils.instance_proc(path) if eval.include?("path")
  end

  element_options = filter_options.delete(:options) || {}

  before_action(filter_options) do |controller|
    controller.send(:add_breadcrumb, name, path, element_options)
  end
end