What is the simplest/shortest way to respond in an API controller. Currently the following works:
respond_to do |format|
format.json { render 'client', status: :ok }
end
however this controller will only ever respond to json (respond_to :json) so the whole respond_to do |format| thing seems like unnecessary code.
Ideally I would just like to do something simple like:
render 'client', status: :ok
Update: I neglected to mention that: 'client' is a jbuilder template that does not match my action name.
You can use render directly
render json: 'client', status: :ok
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With