module BreadcrumbsRails::ActionController

Protected Instance Methods

add_breadcrumb(name, options = {}) click to toggle source

# File lib/breadcrumbs_rails/action_controller.rb, line 24
def add_breadcrumb(name, options = {})
  url_helpers = Rails.application.routes.url_helpers

  if options[:path]
    options[:path] = if url_helpers.methods.include?(options[:path])
                       url_helpers.send(options[:path])
                     else
                       options[:path]
                     end
  end

  self.breadcrumbs_gem[:breadcrumbs] << {
    name:      name,
    path:      options[:path].to_s,
    params:    options[:params] || {},
    title:     options[:title],
    html_safe: options[:html_safe] == true
  }

  self.breadcrumbs_gem[:localize]  = options[:localize]  == true unless options[:localize].nil?
  self.breadcrumbs_gem[:html_safe] = options[:html_safe] == true unless options[:html_safe].nil?
end
breadcrumbs_gem() click to toggle source