Render :action "call method first?"

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

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 S. [email protected]

Chris M. 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 S. [email protected]

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs