Sha256: bc202ab8dc650a215afc40bd2ba9e3154a730e06bb050b242c445efd97525d48

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

module Breadcrumble
  module ActionController
    def self.included(klass)
      klass.extend(ClassMethods)
      klass.helper_method :add_crumb, :breadcrumbs
    end

    module ClassMethods
      def add_crumb name, url
        before_filter do |controller|
          controller.send :add_crumb, name, url
        end
      end
    end

    protected

    def add_crumb(name, url = '')
      @breadcrumbs ||= []
      @breadcrumbs << { name: name, url: url }
      puts @breadcrumbs
    end

    def breadcrumbs
      @breadcrumbs
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
breadcrumble-1.0.0 lib/breadcrumble/action_controller.rb
breadcrumble-0.0.3 lib/breadcrumble/action_controller.rb
breadcrumble-0.0.1 lib/breadcrumble/action_controller.rb