jsonapi-suite / jsonapi_compliable

MIT License
20 stars 35 forks source link

Allow for per-action resources #99

Closed richmolj closed 6 years ago

richmolj commented 6 years ago

Sometimes you want index powered by ElasticSearch but show is a normal ActiveRecord Resource. While we still support the existing syntax, you can now pass a hash of per-action Resources:

class PostsController < ApplicationController
  jsonapi resource: {
    index: PostSearchResource,
    show: PostResource
  }
end
richmolj commented 6 years ago

@wadetandy fyi

wadetandy commented 6 years ago

Looks good. Suggest adding a “default” option as well, as that will save typing for a bunch of similar actions when overriding.