Extensions
Extensions are helper modules or classes we ship with Praxis that extend the default functionality. They can be extremely useful to reuse pattern, reuse boilerplate or provide common functionality. However, they are completely optional and must be explicitly required when you choose to use them.
Praxis currently includes the following extensions, all under the Praxis::Extensions
namespace:
FieldSelection
: adds an enhanced version ofAttributor::FieldSelector
suitable for defining API parameters that describe which fields to return in responses. I.e. a compatible (yet simplified) GraphQL type syntax for field selection.Rendering
: addsrender
anddisplay
helper methods to controllers to reduce common boilerplate in producing rendered representations of media types and setting response “Content-Type” headers.MapperSelectors
addsController#set_selectors
, which sets selectors in the controller’sidentity_map
to ensure any fields and associations necessary to render the:view
and/or:fields
params specified in the request are loaded for a given model whenidentity_map.load(model)
is called.FieldExpansion
provides aController#expanded_fields
helper for processing:view
and/or:fields
params to determine the final set fields necessary to handle the request.