Gavri Fernandez
2005-Feb-23 17:21 UTC
Specifying templates instead of using the default ones
Hi everyone, I''m using the login generator and would like to use the same view template for both the login and logout actions. How do I specify the template to be used for a particular action? Thank you, -- Gavri --------------------------------------------------- I blog here: http://gavri.blogspot.com
Michael Raidel
2005-Feb-23 18:07 UTC
Re: Specifying templates instead of using the default ones
> I''m using the login generator and would like to use the same view > template for both the login and logout actions. How do I specify the > template to be used for a particular action?You use the render_action command in the appropriate controller action. For example: def logout # other code here render_action ''login'' end
Gavri Fernandez
2005-Feb-26 14:29 UTC
Re: Specifying templates instead of using the default ones
On Wed, 23 Feb 2005 19:07:41 +0100, Michael Raidel <michael.raidel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m using the login generator and would like to use the same view > > template for both the login and logout actions. How do I specify the > > template to be used for a particular action? > > You use the render_action command in the appropriate controller > action. For example: > > def logout > # other code here > render_action ''login'' > end >Hi, Thanks, but I want the url to reflect the new action rendered without having to use a client-side redirect. Is that possible? -- Gavri --------------------------------------------------- http://gavri.blogspot.com
Jarkko Laine
2005-Feb-26 14:48 UTC
Re: Specifying templates instead of using the default ones
On 26.2.2005, at 16:29, Gavri Fernandez wrote:> > Hi, > Thanks, but I want the url to reflect the new action rendered > without having to use a client-side redirect. Is that possible?render_action is not a client-side redirect. It just selects which template the action will use. If you don''t use render_action, the action will use the template with the same name as the action. //jarkko> > -- > Gavri > --------------------------------------------------- > http://gavri.blogspot.com > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Gavri Fernandez
2005-Feb-26 15:06 UTC
Re: Specifying templates instead of using the default ones
On Sat, 26 Feb 2005 16:48:38 +0200, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote:> > On 26.2.2005, at 16:29, Gavri Fernandez wrote: > > > > > Hi, > > Thanks, but I want the url to reflect the new action rendered > > without having to use a client-side redirect. Is that possible? > > render_action is not a client-side redirect. It just selects which > template the action will use. If you don''t use render_action, the > action will use the template with the same name as the action.I understood that much. What I''d like to know is how to structure the application (method names, templates, links, form submission actions) so that I have complete control over the url displayed in the address bar and also the page rendered for the user. And all of this without using client-side redirects. This is possible, I know, but what is the common way such a requirement is designed for and built. Having a separate method in the controller for each task of the application is neat, but the url''s get ugly. -- Gavri http://gavri.blogspot.com
Gavri Fernandez
2005-Feb-26 19:10 UTC
Re: Specifying templates instead of using the default ones
On Sat, 26 Feb 2005 20:36:50 +0530, Gavri Fernandez <gavri.fernandez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I understood that much. What I''d like to know is how to structure the > application (method names, templates, links, form submission actions) > so that I have complete control over the url displayed in the address > bar and also the page rendered for the user. And all of this without > using client-side redirects. This is possible, I know, but what is the > common way such a requirement is designed for and built. > > Having a separate method in the controller for each task of the > application is neat, but the url''s get ugly.Okay, I finally did something I should have done before mailing the list. Read the documentation. Client-side redirects _is_ the rails way to decouple actions from urls http://api.rubyonrails.org/classes/ActionController/Base.html -- Gavri http://gavri.blogspot.com