Eddie Verkhoturov
2010-Aug-21 12:53 UTC
[respond_with] Need comments for #5199 on rails.lighthouseapp.com
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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.