merb 0.4.0 - redirect problems

Chris Farmiloe chris at oxdi.eu
Fri Sep 21 06:53:14 EDT 2007


Yeah that, redirect really wasn't ready and shouldn't have been in  
the patch.

if a raise'd version is ever left in it should be with a "!"

def redirect!(url)
	...
end

since it would stop execution, and that is not how you always want it.

everyone get your +1's on #188 ;)





Regards

Farms.
Design & Dev


Oxygen.
http://www.oxdi.eu




On 21 Sep 2007, at 11:46, ry dahl wrote:

> I love Chris' controller exceptions rewrite, but I don't think
> redirects should be handled with exceptions. It used to be very
> simple:
>
> def redirect(url)
>   MERB_LOGGER.info("Redirecting to: #{url}")
>   set_status(302)
>   headers.merge!({'Location'=> url})
>   return ''
> end
>
> On 9/21/07, Adam Roth <adamjroth at gmail.com> wrote:
>> I had redirects working just the other day... before I upgraded to  
>> the
>> latest release. Can somebody please chime in as to why this simple  
>> redirect
>> is throwing an error?
>>
>> Controller:
>> -----------------------
>> def do
>>   redirect "http://www.ebay.com"
>> end
>>
>> Error Output:
>> -------------------------
>> Internal server error 500
>> uninitialized constant
>> Merb::ControllerMixin::MovedTemporarily
>>
>> in /lib/merb/mixins/controller.rb:
>>
>> def redirect( url )
>>   MERB_LOGGER.info("Redirecting to: #{url}")
>>   raise MovedTemporarily, url
>> end
>>
>> Thanks
>> Adam
>>
>>
>> _______________________________________________
>> Merb-devel mailing list
>> Merb-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/merb-devel
>>
>>
> _______________________________________________
> Merb-devel mailing list
> Merb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/merb-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070921/7bc85527/attachment-0001.html 


More information about the Merb-devel mailing list