Hi,
Thest are two methods:-
- redirect_to :action => ‘list’
- render :action => ‘list’
what is difference between these two methods???
Thanks.
Prash
Hi,
Thest are two methods:-
what is difference between these two methods???
Thanks.
Prash
Am Mittwoch, den 22.03.2006, 10:53 +0100 schrieb Prashant T.:
Hi,
Thest are two methods:-
- redirect_to :action => ‘list’
- render :action => ‘list’
what is difference between these two methods???
redirect_to :action => ‘list’ forces the clients browser to request the
list action.
Norman T.
On Mar 22, 2006, at 1:53 AM, Prashant T. wrote:
Thest are two methods:-
- redirect_to :action => ‘list’
This causes an HTTP redirect to be returned to the browser,
which then fetches the new URL.
- 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 M.
On Mar 22, 2006, at 11:21, Tom M. 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
Xavier N. 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
Am Mittwoch, den 22.03.2006, 02:21 -0800 schrieb Tom M.:
On Mar 22, 2006, at 1:53 AM, Prashant T. wrote:
- 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/ActionController/Base.html#M000178
–
Norman T.
On Mar 22, 2006, at 18:21, Tom M. wrote:
I hate it when I do that!
Heh, nevermind, I learnt it the hard way a while back :-).
– fxn
On Mar 22, 2006, at 11:21, Tom M. 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 N. 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 T. wrote:
That’s wrong. The action never gets called. Only the template for that
action is rendered.
Thanks for the corrections, Xavier and Norman!
I hate it when I do that!
–
– Tom M.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs