Michael Koziarski wrote:
>> 1.  Common use case.
>> 2.  Recommended pattern we should encourage.
>> 3.  Avoid boilerplate code.
>>
>> And that's true for a lot of other status codes, many of which already get
>> treatment in Rails.  That treatment depends on the context, for example,
>> mapping ActiveRecord exception to 4xx status code is more developer-friendly
>> than catching the exception yourself and calling a method.  For 303 it
>> happens to be calling a method.
>>     
>
> What other status codes get a special method?
>
> Each additional method is something we'll have to support going
> forward.  Something that's easy to add now, gradually becomes harder
> and harder to support as it picks up users and features.  On the whole
> we're better off not adding a feature till the use case is really
> compelling, and I'm just not seeing that here.
>
>
>   
According to my sources, the HTTP protocol is not going to change any 
time soon, so I'm not extending an invitation to go down the slippery 
slope of polluting core with methods by the boatload.  This is a very 
specific use case, I suggest we treat it as such.  The questions we 
should ask are: is this common enough? and what is the best treatment?

When you're working strictly with Web browsers, 302 (redirect_to) is 
good enough, or you can 200 (render).  Not so for the programmable Web, 
which makes a clear distinction between redirect and see other.  Rails 
2.0 is tackling this sweet spot, with all the work around resources and 
programmable data formats (XML, JSON), so it's certainly within scope.

In fact, if you consider ActiveResource part of Rails, then the lack of 
treatment for 303 is a bug.  Have a look at ActiveResource to see how it 
reacts to redirect_to following a POST.  By that measure, we have an 
expectation to 303 in the framework.

Most of my controllers have a create action, and all of these 
controllers I expect to expose as RESTful services.  If the same is true 
for other people, then this case is not just specific but also quite 
common.

In my opinion that's enough evidence for use to seriously consider how 
we handle 303 in the framework.

Assaf



--~--~---------~--~----~------------~-------~--~----~
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 [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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to