Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: already initialized constant VERIFY_PEER

When I try to start the server I get the following warning:

/Users/sumitkalra1984/MVP/config/initializers/devise.rb:5: warning: already initialized constant VERIFY_PEER   

My devise file:

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if Rails.env.development?  

How do I find where the constant is already defined, and how do I overwrite that definition?

like image 242
Ishan Sharma Avatar asked Sep 19 '13 09:09

Ishan Sharma


1 Answers

While I cannot find where else the constant is initialized, you can silence the warning by wrapping that line in a silence_warnings block.

silence_warnings do
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE unless Rails.env.production?
end

See: http://api.rubyonrails.org/classes/Kernel.html#method-i-silence_warnings

like image 129
ryanttb Avatar answered Sep 22 '22 06:09

ryanttb