Anirudh Madhavan
Anirudh Madhavan

Reputation: 63

undefined local variable or method `env' for method in controller

I'm currently using 'gon' to pass my client id for payment to the javascript sdk of the payment gateway (Braintree in my case).

When I try to set the client id generated to a 'gon' variable, I'm facing this error.

Basically this is my code

def new
  gon.client_token = generate_client_token
end
.
.
.
private
def generate_client_token
  Braintree::ClientToken.generate
end

And I'm using 'figaro' for environment variables.

Upvotes: 3

Views: 753

Answers (1)

channa ly
channa ly

Reputation: 9937

I had the same problem. My rails 5.2.3 and gon 5.2.3. After upgrading the gon to 6.2.0 the issue went away.

Upvotes: 1

Related Questions