Hi, I know when I call: render :controller => ''some'', :action => ''thing'' It doesn''t call the method ''thing'' before render the template ''thing.rhtml'', but I need some instance variable which are in the ''thing'' method, how can I let it call the method ''thing'' and then render the template? Regards, Jamal -- 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 -~----------~----~----~----~------~----~------~--~---
I usually set up another method called "set_up_country_list" or whatever, which sets up the instance variables that you need. Then your original "thing" method, and this other action, can both call "set_up_country_list" before rendering the view. Chris On May 6, 11:34 am, Jamal Soueidan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I know when I call: > > render :controller => ''some'', :action => ''thing'' > > It doesn''t call the method ''thing'' before render the template > ''thing.rhtml'', but I need some instance variable which are in the > ''thing'' method, how can I let it call the method ''thing'' and then render > the template? > > Regards, > Jamal > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Chris Mear wrote:> I usually set up another method called "set_up_country_list" or > whatever, which sets up the instance variables that you need. Then > your original "thing" method, and this other action, can both call > "set_up_country_list" before rendering the view. > > Chris > > On May 6, 11:34 am, Jamal Soueidan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>I did not understand what you mean? def fake end def thing end def call_from_here in this template view call fake method to setup instance variabe which can be used in thing template?????:S end -- 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 -~----------~----~----~----~------~----~------~--~---