Ruby on Rails Thursday, September 4, 2014

On 4 September 2014 21:38, António <ajdacr@gmail.com> wrote:
> Hi Colin,
>
>
> Thanks for your answer,
>
>
>
> The variable @session is a variable I "created" to store the "user id" of a
> user when the user logs in.
>
>
>
> The second controller checks the variable for knowing whether a user is
> logged in. The idea is the @session variable to be a "global variable" of
> the application, that is, used by several controllers. According to your
> answer, it is not possible. Is that true?

Whilst technically it may be possible in some situations that is
certainly not the way to achieve the result you want. If it contains
data that can be recalculated then possibly use a before filter.
Alternatively the rails session variable may be the right way to go.

As I said, work right through a good tutorial and such things should
become clear, or at least less muddy.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtxN6eUbGuTh890Q_L4PRk-PzVQU21N5kdsEVpSNVjJ%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment