This error occurs because one of the hash values ββin the omniauth['extra']['raw_info']['location']['name'].nil? chain. omniauth['extra']['raw_info']['location']['name'].nil? returns nil, and this is not the last call to ['name'].
If, for example, omniauth['extra']['raw_info'] returns nil, you are actually trying to call nil['location'] , which causes an error in ruby.
You can easily catch this error:
res = omniauth['extra']['raw_info']['location']['name'].nil? rescue true unless res #your code here end
Please note that the above code will fill the res variable with true if the hash value ['name'] is nil or any other hash value in the chain returns nil.
Erez rabih
source share