Sha256: d0d8bb38546305d181c9454751274c8a460223aa5ac624bac3035f93279d1c40

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module RailsCrumbs
  module RailsCrumbsController

    def set_railscrumb(name, path, options = {})
      self.railscrumbs << Crumb.new(name, path, options)
    end

    def railscrumbs
      @railscrumbs ||= []
    end

    def self.included(base)
      base.send(:extend, ClassMethods)
    end

    module ClassMethods
      def set_railscrumb(name, path = nil, options = {})
        only = options.delete(:only){ [] }
        if only.empty?
          filter_options = {}
        else
          filter_options = {:only => only}
        end

        before_filter(filter_options) do |controller|
          controller.send(:set_railscrumb, name, path, options)
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_crumbs-0.0.2 lib/rails_crumbs/controller.rb