Sha256: 7efe3d1da3b2875af309a8f550132434a13842e5f766a9ad12219238275c534f
Contents?: true
Size: 1.04 KB
Versions: 12
Compression:
Stored size: 1.04 KB
Contents
module JSONAPIonify::Api module Resource::Defaults::ResponseContexts extend ActiveSupport::Concern included do context(:invalidate_cache?, readonly: true, persisted: true) { |c| c.includes.present? } # Response Objects context(:links, readonly: true, persisted: true) do |context| context.response_object[:links] end context(:meta, readonly: true, persisted: true) do |context| JSONAPIonify::Structure::Helpers::MetaDelegate.new context.response_object end context(:response_object, readonly: true, persisted: true) do |context| JSONAPIonify.parse(links: { self: context.request.url }) end context(:response_collection, readonly: true) do |context| if context.root_request? collections = %i{ paginated_collection sorted_collection collection } context.public_send collections.find { |c| context.respond_to? c } else context.collection end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems