Sha256: aa78d2c5444a6aadd7a8a71e5d2ddc27e214a1df30d63631e6f50c10bd9b0d60
Contents?: true
Size: 891 Bytes
Versions: 8
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true module Praxis module Extensions module FieldExpansion extend ActiveSupport::Concern included do Praxis::ActionDefinition.include ActionDefinitionExtension end def expanded_fields @expanded_fields ||= begin expansion_filter = respond_to?(:display_attribute?) ? method(:display_attribute?) : nil request.action.expanded_fields(request, media_type, expansion_filter) end end module ActionDefinitionExtension extend ActiveSupport::Concern def expanded_fields(request, media_type, expansion_filter) uses_fields = params&.attributes&.key?(:fields) fields = uses_fields ? request.params.fields.fields : true Praxis::FieldExpander.expand(media_type, fields, expansion_filter) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems