Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method `env' for ApplicationController:Class #157

Closed
cinic2003 opened this issue Sep 19, 2017 · 3 comments
Closed
Assignees

Comments

@cinic2003
Copy link

In Controller, the env['warden'] always is undefined, but when change to request.env['warden'], it worked fine, the wiki said env['warden'], what did I do wrong?

Any advice? Thanks

@jsmestad jsmestad self-assigned this Sep 19, 2017
@jsmestad
Copy link
Collaborator

jsmestad commented Sep 19, 2017

Warden docs are written as if you are using Rack directly. In Rack you have direct access to env.

It sounds like you are using Rails. If that is the case, Rails wraps Rack middleware's env variable as a method on the request object.

@mattbarona
Copy link

A bit new here, so what exactly is the solution?

instead of raise env["omniauth.auth"].to_yaml I put raise request.env ["omniauth.auth].to_yaml

Still getting an error did I understand the concept correctly?

@jsmestad
Copy link
Collaborator

@mattbarona I think you are referring to omniauth and not warden, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants