Session variable error

Hii guys!

I’m new to ROR…
I have a helpter in my rails APP with 2 classes inside it

There’s a method that needs to set a session variable, but I’m getting
an error
def send_upload_request(entry)
.
.
some code here
.
.
xmldoc = XmlSimple.xml_in(data)
@upload_token = xmldoc[‘token’].to_s
@upload_url = xmldoc[‘url’].to_s
session[“upload_token”] = @upload_token # here raises the
error
session[“upload_url”] = @upload_url
end

I’m getting the following error message:

undefined local variable or method `session’ for
#<ModuleName::ClassName

The session only matters for controllers and views. The models don’t
have access to the session hash unless you explicitly pass variables
in.

It looks like you are mixing up controller logic from model logic.

-Danimal

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