2017-09-22 13 views

답변

0

당신은 render_jsonapiclass 인수를 설정해야합니다.

# app/controllers/api/v1/posts_controller.rb 
module Api 
    module V1 
    class PostsController < Api::V1::ApplicationController 
     # ... 

     def index 
     posts = Post.all 
     render_jsonapi(posts, class: { Post: Api::V1::SerializablePost }) 
     end 

     # ... 
    end 
    end 
end