Sha256: 0c51e44bd6be37397d0c243cc1b787c31d98c440d6578de5291d40bc7dc65ff9

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require_dependency "<%= project_name %>/application_controller"

module <%= project_class %>
  module Admin
    class AdminController < ApplicationController
      inherit_resources  # Use inherited_resources

      helper ::ExpressAdmin::AdminHelper
      before_filter :authenticate_user! if defined?(Devise)
      layout "<%= project_name %>/admin"

      before_filter :load_collection, only: [:show]
      before_filter :build_new_resource, only: [:index]

      def show
        show! do |format|
          format.html { render :index }
        end
      end

      private

        def load_collection
          collection # from InheritedResources
        end

        def build_new_resource
          @resource_params = {}
          build_resource
        end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
express_admin-1.1.0 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb