I am new to rails and grape so forgive the naivety of the question.
I am trying to use nested resources to make CRUD requests to my postgres db.
1. First off, when building an API through grape that has nested resources is the conventional structure, API::V1::Parent::Child, when mounting applications? I am not currently doing that, but rather having the parent and child be siblings in term of folder structure (addresses is a child of people)
2. Secondly when calling the nested resources is it okay to say
resources :parent do
route_param :id do
params do
{ child attributes for the model being queried}
end
post route_url do
if Parent.find(:id)
Child.create(declared(params))
3. If question 2 is okay, then why does the query not enter the data into the database? (I was able to enter data into the db using its own separate module) When I currently try with what I have, through postman, the response is the same body that I attempted to add to the db.
Followed this
guide to get started with grape