Monday, January 6, 2014

Re: [Rails] Problems testing a destroy failure

On Jan 6, 2014, at 10:56 AM, Clem Rock wrote:

> Walter - thanks for getting back to me on this.
>
> First of all, I should have made this more clear - the delete action is
> in the controller, not the model and the @payment_info model object is
> using the destroy method.
>
> To me, this method seems to be as straight forward as possible - you
> attempt to destroy a verified active record object and if the destroy is
> successful, then redirect to the the new action, if it fails display the
> error and redirect to the edit method. I don't see a logic problem
> anywhere in this method so I'm not a big fan of trying to change the
> method just to satisfy testing.

I'm hardly an expert here. I looked in a simple site I did a while back using scaffold, since I don't have my Rails 4 legs under me yet, and scaffold maps the DELETE REST method to YourController::destroy. If you're using the generic routing, then the DELETE request will go to destroy. Apologies if your routes are not the same as mine, and you've already ruled this out.

Walter

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f44747b8a43b50ff9f0e7c93287f60cc%40ruby-forum.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/DF3B0E10-C88E-4508-9229-C47EE0047C90%40wdstudio.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate