Passing data between controller methods


#1

Hi All

What is the best way to pass data between different controller methods
in support of different views?

Thanks


#2

removed_email_address@domain.invalid wrote:

Hi All

What is the best way to pass data between different controller methods
in support of different views?

Thanks

I am trying to do the same but it looks like every controller gets its
own session, so variables can’t be exchanged via session[].

It looks like rails feature.

Has anyone been dealing with the same problem.

by
TheR


#3

Could you please explain what you mean by “passing data”? Do you mean
calling other methods in a controller or do you mean keeping information
around through different requests.

If you mean the latter, then your session is the way to go if that
information is not fit to be in the database.

Damjan, could you expound on your response? Controllers do not get their
own
session. The session is the construct built to keep information around
for
the entire time a user is using your site.

Jason


#4

Jason R. wrote:

Could you please explain what you mean by “passing data”? Do you mean
calling other methods in a controller or do you mean keeping information
around through different requests.

If you mean the latter, then your session is the way to go if that
information is not fit to be in the database.

Damjan, could you expound on your response? Controllers do not get their
own
session. The session is the construct built to keep information around
for
the entire time a user is using your site.

Jason

I was playing with Ajax today and got this strange behaviour. If the
Ajax called method was in the same controller class, then Ajax call had
the same session ID (cleary seen in Mongrel). If the Ajax response
method was in another controller class, the call got different session
ID an thus proper session[] could not be reached in caller method.

I was testing loading some Ajax data on page load and it made me crazy
for over an hour until I changed the program and call Ajax method within
same controller.

by
TheR