-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renderer adding an extra call to the DB for resources collection #106
Comments
It's actually adding the 2 extra prev. steps of |
@benoror could you share your serializer implementation? Also this is probably an issue for the https://github.com/jsonapi-serializer/jsonapi-serializer/ ? |
The second example is only using
class PropertySerializer
include JSONAPI::Serializer
belongs_to :broker
belongs_to :status, serializer: :tag, id_method_name: :status_tag_key
belongs_to :type, serializer: :tag, id_method_name: :type_tag_key
belongs_to :location, serializer: :tag, id_method_name: :location_tag_key
belongs_to :agent, serializer: :account
has_many :features
attributes :title, :description, :published, :built_at,
:retail_price, :retail_price_cents, :retail_price_currency,
:rent_price, :rent_price_cents, :rent_price_currency,
:rto_price, :rto_price_cents, :rto_price_currency,
:rooms, :bathrooms, :floors, :parking_lots, :video_url,
:area, :area_units, :land_area, :land_area_units,
:latitude, :longitude, :street_address, :street_number, :postal_code
attribute :images do |object|
attachments(object.images)
end
attribute :plans do|object|
attachments(object.plans)
end
end |
When using
jsonapi:
renderer I found out it was effectively adding an extra call to the resources, impacting performance:Compare results when using Rails' default
json:
rednerer andjsonapi-serializer
directly:The text was updated successfully, but these errors were encountered: