Hi, Thest are two methods:- 1) redirect_to :action => 'list' 2) render :action => 'list' what is difference between these two methods?????? Thanks. Prash
on 2006-03-22 10:53
on 2006-03-22 11:20
Am Mittwoch, den 22.03.2006, 10:53 +0100 schrieb Prashant Tiwari: > Hi, > Thest are two methods:- > 1) redirect_to :action => 'list' > 2) render :action => 'list' > > what is difference between these two methods?????? redirect_to :action => 'list' forces the clients browser to request the list action. render :action => 'list' will render the template list.rhtml without calling or redirecting to the list action. -- Norman Timmler http://blog.inlet-media.de
on 2006-03-22 11:22
On Mar 22, 2006, at 1:53 AM, Prashant Tiwari wrote: > Thest are two methods:- > 1) redirect_to :action => 'list' This causes an HTTP redirect to be returned to the browser, which then fetches the new URL. > 2) render :action => 'list' This causes a 'server side' redirect, and causes the other action to be executed without the browser knowing anything about the change. > what is difference between these two methods?????? -- -- Tom Mornini
on 2006-03-22 11:37
Am Mittwoch, den 22.03.2006, 02:21 -0800 schrieb Tom Mornini: > On Mar 22, 2006, at 1:53 AM, Prashant Tiwari wrote: > > 2) render :action => 'list' > > This causes a 'server side' redirect, and causes > the other action to be executed without the browser > knowing anything about the change. That's wrong. The action never gets called. Only the template for that action is rendered. http://api.rubyonrails.com/classes/ActionControlle... -- Norman Timmler http://blog.inlet-media.de
on 2006-03-22 11:41
On Mar 22, 2006, at 11:21, Tom Mornini wrote: > This causes a 'server side' redirect, and causes > the other action to be executed without the browser > knowing anything about the change. Almost. The action is not executed, only the corresponding template list.rhtml is rendered as if the call was render :view => 'list' # imaginary API being equivalent to render :template => "#{controller_name}/list.rhtml" modulus the template extension. It could even happen that the list action renders something else. Server-side "redirects" are done with render_component. -- fxn
on 2006-03-22 17:37
Xavier Noria wrote: > render :view => 'list' # imaginary API > > being equivalent to > > render :template => "#{controller_name}/list.rhtml" > > modulus the template extension. It could even happen that the list > action renders something else. > > Server-side "redirects" are done with render_component. Hmm, I never knew this... seems like an unfortunate decision, bound to create confusion. b
on 2006-03-22 18:21
> On Mar 22, 2006, at 11:21, Tom Mornini wrote: > >> This causes a 'server side' redirect, and causes >> the other action to be executed without the browser >> knowing anything about the change. On Mar 22, 2006, at 2:41 AM, Xavier Noria wrote: > Almost. The action is not executed, only the corresponding template > list.rhtml is rendered as if the call was On Mar 22, 2006, at 2:37 AM, Norman Timmler wrote: > That's wrong. The action never gets called. Only the template for that > action is rendered. > > http://api.rubyonrails.com/classes/ActionControlle... Thanks for the corrections, Xavier and Norman! I hate it when I do that! :-) -- -- Tom Mornini
on 2006-03-22 18:23
On Mar 22, 2006, at 18:21, Tom Mornini wrote: > > I hate it when I do that! :-) Heh, nevermind, I learnt it the hard way a while back :-). -- fxn
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.