Sha256: 4acef5c9a517371964a503278952bb89e6377ef9ee4c9970f144302a1120155b

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

module SimpleAdmin
  class EntitiesController < BaseController
    before_action :load_models!
    before_action :entity_service

    def index
      render json: @entity_service.index_action
    end

    def show
      resource_klass = params[:id].constantize

      render json: @entity_service.show_action(resource_klass)
    end

    private

      def entity_service
        @entity_service = EntityService.new
      end

      def load_models!
        Rails.application.eager_load!
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simpleadmin-1.4.0 app/controllers/simple_admin/entities_controller.rb
simpleadmin-1.3.0 app/controllers/simple_admin/entities_controller.rb