Hello all, i would like to change the default view path for one of my controllers. Like StudentsController should use templates located in views/persons instead views/students. Is that possible? Greetings, Mike
I''m pretty sure you can just call render at the end of the action to render whatever you want. http://api.rubyonrails.org/classes/ActionController/Base.html#M000676 I''m not sure you would want to do this though. On Thu, Jul 9, 2009 at 8:55 AM, mike <mikezter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > i would like to change the default view path for one of my controllers. > Like StudentsController should use templates located in views/persons > instead views/students. Is that possible? > > Greetings, Mike > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jap thats right. but is there a way to change the default path without actually touching every controller method? On Thu, Jul 9, 2009 at 3:00 PM, James Englert <englert.james-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> I''m pretty sure you can just call render at the end of the action to render > whatever you want. > > http://api.rubyonrails.org/classes/ActionController/Base.html#M000676 > > I''m not sure you would want to do this though. > > > On Thu, Jul 9, 2009 at 8:55 AM, mike <mikezter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hello all, >> >> i would like to change the default view path for one of my controllers. >> Like StudentsController should use templates located in views/persons >> instead views/students. Is that possible? >> >> Greetings, Mike >> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Would an after_filter work? On Thu, Jul 9, 2009 at 9:04 AM, mike <mikezter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> jap thats right. but is there a way to change the default path without > actually touching every controller method? > > > On Thu, Jul 9, 2009 at 3:00 PM, James Englert <englert.james-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> I''m pretty sure you can just call render at the end of the action to >> render whatever you want. >> >> http://api.rubyonrails.org/classes/ActionController/Base.html#M000676 >> >> I''m not sure you would want to do this though. >> >> >> On Thu, Jul 9, 2009 at 8:55 AM, mike <mikezter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Hello all, >>> >>> i would like to change the default view path for one of my controllers. >>> Like StudentsController should use templates located in views/persons >>> instead views/students. Is that possible? >>> >>> Greetings, Mike >>> >>> >>> >> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
mike wrote:> Hello all, > > i would like to change the default view path for one of my controllers. > Like > StudentsController should use templates located in views/persons instead > views/students. Is that possible? > > Greetings, MikeGo to your routes file in config and do something similar: map.persons ''/persons'', :controller => ''students'', :action => ''index'' -- Posted via http://www.ruby-forum.com/.
i would like to change the view path via a param On Thu, Jul 9, 2009 at 3:10 PM, Älphä Blüë <rails-mailing-list@andreas-s.net> wrote:> > mike wrote: > > Hello all, > > > > i would like to change the default view path for one of my controllers. > > Like > > StudentsController should use templates located in views/persons instead > > views/students. Is that possible? > > > > Greetings, Mike > > Go to your routes file in config and do something similar: > > map.persons ''/persons'', :controller => ''students'', :action => ''index'' > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Cyril Lavedrine
2009-Jul-09 13:58 UTC
Re: Change default view path for an ActionController
Hi, I''d say something like that might do : (in your student controller, in the action you want) respond_to do |format| format.html { render :controller => "person", :action => your_action } end Cyril 2009/7/9 mike <mikezter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> i would like to change the view path via a param > > > On Thu, Jul 9, 2009 at 3:10 PM, Älphä Blüë < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> mike wrote: >> > Hello all, >> > >> > i would like to change the default view path for one of my controllers. >> > Like >> > StudentsController should use templates located in views/persons instead >> > views/students. Is that possible? >> > >> > Greetings, Mike >> >> Go to your routes file in config and do something similar: >> >> map.persons ''/persons'', :controller => ''students'', :action => ''index'' >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pierre Olivier Martel
2009-Jul-22 18:20 UTC
Re: Change default view path for an ActionController
I just had the same problem and I solved it by creating symlinks between the folders. So, for your example, you could try this command in your view folder : link -s persons students It would be nice to have a more standard way to change the view folder path... Hope it helps!