Sha256: 708cffd18c3ace87d84c2f2e44c6c6d7de649d0be4ed55b9d4ebb1fa1e3feb60

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

module MenuBuilder
  module Controller
    extend ActiveSupport::Concern

    def menu_items(*items)
      instance_variable_set('@menu_items', items)
    end
    alias_method :menu_item, :menu_items

    module ClassMethods
      def menu_items(*items)
        options = items.extract_options!

        before_action(options) do |controller|
          controller.instance_variable_set('@menu_items', items)
        end
      end
      alias_method :menu_item, :menu_items

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
menu_builder-0.4.4 lib/menu_builder/controller.rb