[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[Rails] redirect_to problem

Dmitry V. Sabanin

10/3/2004 6:16:00 AM

Hi everyone!

I have a problem with my redirect_to usage. Following code in my controller,
doesn't redirects to a page, but instead gives me '200 OK' HTTP response,
with information that document was moved, and link to a page where I
redirected user to.

def destroy
user = User.find(@params["id"])
flash['notice'] = "User '#{user.name}' deleted"
user.destroy
redirect_to :action => "list"
end

This was taken almost exactly from the tutorial and it was workin' for me
nicely for a few days until I messed up something, I don't know what.
There's a set of after_filters that I use to implement nested layouts, maybe
problem is there. I'd appreciate if someone will tell me what that behavior
means, so I'll be able to investigate further. Of course I could check the
sources to see it by myself, but I'm not feeling *that* comfortable with
Rails yet :)

Thanks in advance,
--
sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.
Spam Here -> postmaster@sco.com


2 Answers

David Heinemeier Hansson

10/4/2004 7:00:00 AM

0

> This was taken almost exactly from the tutorial and it was workin' for
> me
> nicely for a few days until I messed up something, I don't know what.
> There's a set of after_filters that I use to implement nested layouts,
> maybe
> problem is there. I'd appreciate if someone will tell me what that
> behavior
> means, so I'll be able to investigate further. Of course I could check
> the
> sources to see it by myself, but I'm not feeling *that* comfortable
> with
> Rails yet :)

It does indeed seem like you have a problem with the after filters. Try
turning them off and see if it works then. If so, I'll be happy to take
a look at your after_filters to help you figure out what the problem is
there.

If you want real time help, I can recommend trying out #rubyonrails on
FreeNet.
--
David Heinemeier Hansson,
http://www.rubyon... -- Web-application framework for Ruby
http://www.in... -- A No-Step-Three Wiki in Ruby
http://www.basec... -- Web-based Project Management
http://www.loudthi... -- Broadcasting Brain
http://www.next... -- Development & Consulting Services



Dmitry V. Sabanin

10/5/2004 2:47:00 PM

0

On Monday 04 October 2004 14:59, David Heinemeier Hansson wrote:
> It does indeed seem like you have a problem with the after filters. Try
> turning them off and see if it works then. If so, I'll be happy to take
> a look at your after_filters to help you figure out what the problem is
> there.
Yep, it was problem with my after filters, I fixed it with following code:

def layout_normal
@content_for_layout = response.body
saved_headers = response.headers.dup # this
render 'layouts/main'
response.headers = saved_headers # and this
true
end

Btw, big thank you and others for Rails!

--
sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.
Spam Here -> postmaster@sco.com