I have a Posts resource, and a User Rating resource.
In my routes.rb
, I have nested the user rating within the posts:
jsonapi_resources :posts do
jsonapi_resources :user_ratings
end
This has exposed the endpoint /posts/{id}/user-ratings
correctly.
However when testing this end point with an {id}
, it is returning all user-ratings
, not just the user-ratings
associated to that post id.
In my posts resource, I have tried adding: has_many :user_ratings
, in user ratings I have tried adding: has_one :post
.
In my models, I have added has_many
and belongs_to
.
Yet nothing I have tried is making the api return just the user ratings associated with a particular post id.
Any insight would be appreciated, thank you.