Evgeniy Dolzhenko
2010-Aug-17 16:59 UTC
Default Responder doesn''t care about whether delete failed or not
With the current Responder there is no way to tell whether API call to delete failed or not as it always returns OK status [1]. I would prefer it to check the deletion status with the AR#destroyed? method and reply with :unprocessable_entity when that return false. Should such behavior be included in default Responder, WDYT? [1] http://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/responder.rb#L171 -- 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.
José Valim
2010-Aug-20 18:03 UTC
Re: Default Responder doesn''t care about whether delete failed or not
destroyed? is not part of ActiveModel API. We could check persisted? but the official way to check if an action was concluded with success or not is by checking if errors are empty or not. On Aug 17, 1:59 pm, Evgeniy Dolzhenko <dolze...@gmail.com> wrote:> With the current Responder there is no way to tell whether API call to > delete failed or not as it always returns OK status [1]. I would > prefer it to check the deletion status with the AR#destroyed? method > and reply with :unprocessable_entity when that return false. Should > such behavior be included in default Responder, WDYT? > > [1]http://github.com/rails/rails/blob/master/actionpack/lib/action_contr...-- 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.