I look for the consideration of ticket of #5199 (https:// rails.lighthouseapp.com/projects/8994/tickets/5199-respond_with- returns-on-put-and-delete-verb)
Most likely my questions are addressed to Jose Valim.
The fact is that I do completely understand the logic of the work of respond_with. Especially, when the matter concerns the use of respond_with for writing JSON API for my site.
Here are my questions:
1. Why respond_with reacts only on GET and POST verbs? If, I change certain object in the model with the verb PUT, then I desire to return the certain information. For example, something like this (in the case of success)
render :json => {:user => @user.id, :result => 0}
or
render :json => {:user => @user.id, :result => 1}
in the case of the failure.
This is impossible either for PUT, or for DELETE. Thus I am forced to forego render_with in favor of render.
2. For example, action answers on URL http://localhost:3000/send_email.json. Why
respond_with {:email => 'test@my.host.com', :status => 'Success!'}
returns nil, while
respond_with [{:email => 'test@my.host.com', :status => 'Success!'}]
does return correct JSON?
I hope that Jose and community will help to explain the situation.