-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
While we were integrating props into our application, we added some additional APIs that were spied on by the Jbuilder.
json.optional!- defines attribute or structure and marks it as optional, during serialization this method checks condition and renders or does not render such attribute
example of usage
json.optional! :properties do
json.optional! :value, -> { object.value } # lambda here is to avoid value calculations before checking conditions for rendering
end
json.extract!- extracts the mentioned attributes or hash elements from the passed object and turns them into attributes of the JSON
example of usage - json.extract! object, :id, :unit
instead of
json.id object.id
json.unit object.unit
json.partial!- renders partial without setting result to some key
@jho406 do you have any plans to integrate such features to PropsTemplate? Or maybe I can share their implementation and then dicsuss/modify/accept/reject them, what do you think?
Metadata
Metadata
Assignees
Labels
No labels