On 2008-11-30, at 18:31, Frederick Cheung wrote: > On 30 Nov 2008, at 21:47, Nick Hoffman wrote: >> On 2008-11-30, at 16:31, David A. Black wrote: >>> Hi -- >>> >>> One good way to think about it is: if you did have an extra check, >>> what would it do? In other words, if create gets executed and >>> params[:book] is nil, what would you want to happen? >> >> Hi David. I was thinking about what do in this situation, and reckon >> that any of these is a good approach to take: >> 1) Send a redirect to an appropriate page and return from the method; >> 2) Render an appropriate page, and return from the method; >> 3) Set params[:book] to an empty Hash; >> > > My take on this: say you made a mistake somewhere, for example your > form is submitting a parameter with the wrong name (or the controller > was using the wrong parameter) and that it wasn't caught by your tests > (after all your tests won't be checking that the inputs you use in > your functional test are the same as those that would be produced by a > browser having rendered your form) > > I want: > - to know about it yourself (ie. David's follow up) > - it be obvious to the user that something bad happened (I.e don't > lull in them into a false sense of security by giving the impression > the record was created fine whereas you actually just created it off > the back of an empty Hash. You don't need to display the full grungey > error page, a 'something bad happened page' is fine usually > > Fred
That's a good point you raise, Fred. The third solution that I proposed could cover up some bugs in your app that you'd want to actually see. Also, as you said, there's no need to fake rainbows and unicorns for a user who submits bad data on purpose. -Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

