he.. I have an action and in this action I want to call an other action for example list in controller article... I now how to do this if the action you want to call is in the same controller: def index list end but what if the action is in a other controller? article/list doesn''t work hope somebody can help me ... -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nice .. I also want to know this... On 01/11/2007, Heldop Slippers <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > he.. > > > I have an action and in this action I want to call an other action > for example list in controller article... > > I now how to do this if the action you want to call is in the same > controller: > > def index > list > end > > but what if the action is in a other controller? > article/list doesn''t work > > > > hope somebody can help me ... > -- > Posted via http://www.ruby-forum.com/. > > > >-- Arun Agrawal Sent from BlackBerry(R) on Hutch --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 1 Nov 2007, at 18:19, Arun Agrawal wrote:> Nice .. I also want to know this... > > On 01/11/2007, Heldop Slippers <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > wrote: > he.. > > > I have an action and in this action I want to call an other action > for example list in controller article... > > I now how to do this if the action you want to call is in the same > controller: > > def index > list > end > > but what if the action is in a other controller? > article/list doesn''t workYou can''t. Why do you want to do this? This probably means that this code you are trying to call should either be part of one of your models or in a module you can include in both controllers. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 1 Nov 2007, at 18:19, Arun Agrawal wrote: > >> I now how to do this if the action you want to call is in the same >> controller: >> >> def index >> list >> end >> >> but what if the action is in a other controller? >> article/list doesn''t work > > You can''t. Why do you want to do this? This probably means that this > code you are trying to call should either be part of one of your > models or in a module you can include in both controllers. > > FredI have an action index where I call for example the action article. for example to do this: if bla than article else login end It would be nise to have that in seperated controllers so that everything is organised ... :( thanxs for the replay -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1 Nov 2007, at 19:26, Heldop Slippers wrote:>> > > I have an action index where I call for example the action article. > > for example to do this: > if bla than > article > else > login > endYou should redirect them to the login page if they need to be logged in Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 1 Nov 2007, at 19:26, Heldop Slippers wrote: >>> >> >> I have an action index where I call for example the action article. >> >> for example to do this: >> if bla than >> article >> else >> login >> end > > You should redirect them to the login page if they need to be logged in > > Fredwel .. yes I now.. it was just an example (and not a realy good one ) .... here is my problem: I have a layout page where a menu and articles are loaded ... when you start the site you are in the action index (in application).. the index will call the actions menu, articles and login (this is in the footer) (and more if nessecery). I have now all the actions in the application but I would like to have them in other controllers. beceause it is more manageble... but I understand that is not possible. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can either put them in a module as has already been mentioned, and then include them in your controllers, or you can put them in helpers/ application_helper, or you can put them in ApplicationController as all your other controllers subclass this, meaning they would automatically inherit them. On Nov 1, 10:27 pm, Heldop Slippers <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > On 1 Nov 2007, at 19:26, Heldop Slippers wrote: > > >> I have an action index where I call for example the action article. > > >> for example to do this: > >> if bla than > >> article > >> else > >> login > >> end > > > You should redirect them to the login page if they need to be logged in > > > Fred > > wel .. yes I now.. > > it was just an example (and not a realy good one ) .... here is my > problem: > > I have a layout page where a menu and articles are loaded ... when you > start the site you are in the action index (in application).. the index > will call the actions menu, articles and login (this is in the footer) > (and more if nessecery). > > I have now all the actions in the application but I would like to have > them in other controllers. beceause it is more manageble... but I > understand that is not possible. > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Su wrote:> You can either put them in a module as has already been mentioned, and > then include them in your controllers, or you can put them in helpers/ > application_helper, or you can put them in ApplicationController as > all your other controllers subclass this, meaning they would > automatically inherit them. > > On Nov 1, 10:27 pm, Heldop Slippers <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>ok.. I did that (put almost all of it in the applicationController) .. A shame it isn''t possible to put it in other controller.. but wel.. thanxs for the reply''s all ... -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---