Sha256: f9bb5b5cd69232250371f9fb73c3966aa88d6cb90e09830324f76f7efa932055

Contents?: true

Size: 899 Bytes

Versions: 4

Compression:

Stored size: 899 Bytes

Contents

module ActiveAdmin
  class Resource
    module Controllers

      # Returns a properly formatted controller name for this
      # config within its namespace
      def controller_name
        [namespace.module_name, resource_name.plural.camelize + "Controller"].compact.join('::')
      end

      # Returns the controller for this config
      def controller
        @controller ||= controller_name.constantize
      end

      # Returns the routes prefix for this config
      def route_prefix
        namespace.module_name.try(:underscore)
      end

      # Returns a symbol for the route to use to get to the
      # collection of this resource
      def route_collection_path
        route = [
          route_prefix, 
          controller.resources_configuration[:self][:route_collection_name], 
          'path'
        ]

        route.compact.join('_').to_sym
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activeadmin-0.5.1 lib/active_admin/resource/controllers.rb
activeadmin-0.5.0 lib/active_admin/resource/controllers.rb
activeadmin-0.5.0.pre1 lib/active_admin/resource/controllers.rb
activeadmin-0.5.0.pre lib/active_admin/resource/controllers.rb