Sha256: 26dcbc212279c4bddf1e71d7d216fa15bc35d0539a8466a8f8b1cefaea5d461b
Contents?: true
Size: 690 Bytes
Versions: 179
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true module Motor class SchemaController < ApiBaseController skip_authorization_check before_action :authorize_resource, only: :show def index render json: { data: schema } end def show render json: { data: schema.find { |model| model[:name] == resource_class.name.underscore } } end private def schema @schema ||= Motor::BuildSchema.call(Configs::LoadFromCache.load_cache_keys, current_ability) end def resource_class @resource_class ||= Motor::BuildSchema::Utils.classify_slug(params[:resource]) end def authorize_resource authorize!(resource_class, :read) end end end
Version data entries
179 entries across 179 versions & 7 rubygems