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::FieldSelectorsuitable 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: addsrenderanddisplayhelper methods to controllers to reduce common boilerplate in producing rendered representations of media types and setting response “Content-Type” headers.MapperSelectorsaddsController#set_selectors, which sets selectors in the controller’sidentity_mapto ensure any fields and associations necessary to render the:viewand/or:fieldsparams specified in the request are loaded for a given model whenidentity_map.load(model)is called.FieldExpansionprovides aController#expanded_fieldshelper for processing:viewand/or:fieldsparams to determine the final set fields necessary to handle the request.