Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 807533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:24:52+00:00 2026-05-15T00:24:52+00:00

I have a User model. I have a Session controller, in which I have

  • 0

I have a User model.

I have a Session controller, in which I have a global user variable that is assigned as follows:

$user = User.authenticate(params[:session][:email], params[:session][:password])

(I’ve made user global just to try to solve this problem, so if there’s a better way please let me know!)

I need to use the email of the logged in user as a parameter to send to Flex part of my website. At the moment I’m creating the link as follows:

<%= link_to "secondpage", secondpage_path(:email => @session.$user.email) 

But I’m getting the following error:

compile error
/Users/benhartney/rails_projects/talk/app/views/layouts/_header.html.erb:12:
syntax error, unexpected tGVAR
…_path(:email =>
@session.$user.email) ).to_s);
@output_buffe…

There’s also a little arrow pointing at $user

If I remove the $ from $user, I get this error:

undefined method `user’ for
nil:NilClass

If I remove the

(:email => @session.user.email)

part, everything works fine, so I think all of the code except for this is ok.

Can anyone tell me what I’m doing wrong?

Thanks for reading!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:24:53+00:00Added an answer on May 15, 2026 at 12:24 am

    I think what you are looking for is a session variable.

    Rails is primarily a framework for creating web applications, and http is stateless, i.e. each request knows nothing about what went on before. To get over this limitiation, web developers use cookies or session variables to simulate maintenance of state, i.e. data, across requests.

    Check out http://guides.rubyonrails.org/action_controller_overview.html#session

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a User model that :has_many other models like Documents, Videos, Posts
I have a model Foo which have a ForeignKey to the User model. Later,
I have a data model that includes common columns like addedBy, editedby (user), addedDate,
For example, if I have a user model and I need to validate login
In my user model, I have an attribute called nickname and validates as such:
Suppose you have two models, User and City, joined by a third model CityPermission:
I have a database that is stuck in single-user mode. I kill the process
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
this is the function I have, in my login controller, which stores data into
I have a Controller bean (SearchController) that has two managed bean as managed properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.