Description
Shows a subject by id
Example
GET http://your.awesome/api/books/1
Response:
200 OK
{
"book": {
"id": 1,
"name": "The Green Mile",
"author": "Stephen King"
}
}
How to customize
- override Params#permitted_fields_for_show to set which params will be shown in response
- override Render#render_subject to set how subject will be rendered
- override Render#render_not_found to set what to render when subject with ID from params is not found
- override Subject#subject_model to set what model will be shown
- override Chains#show_chain to add or remove methods which will be called while updating a subject
Use
Source code
# lib/resting_pug/actions.rb
def show
run_chain(show_chain)
end