jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
319 stars 63 forks source link

Using "preloader" to load associations based on "include" #62

Closed TheRusskiy closed 6 years ago

TheRusskiy commented 6 years ago

Is this already implemented? If not, then do you see any roadblocks in doing so? Thank you :-)

beauby commented 6 years ago

Hi TheRusskiy – I'm thinking about providing a pre-rendering hook so that people could override it as follows: def jsonapi_resources(resources) resources.include(jsonapi_include) if # resources is an activerecord query end

What do you think?

TheRusskiy commented 6 years ago

@beauby great idea, would make it a more universal solution.