I have this strange error (for me) I can not figure out why is happening.
Sometimes when I call RestClient.get 'http://google.com'
I got a response and some times I get this error undefined method '<<' for true:TrueClass
I am using Rails 4.1.8, Ruby 2.1.5p273 and RestClient 1.7.2
2.1.5 :010 > RestClient.get 'https://google.com'
NoMethodError: undefined method `<<' for true:TrueClass
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/rest-client-1.7.2/lib/restclient/request.rb:525:in `log_request'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/rest-client-1.7.2/lib/restclient/request.rb:410:in `transmit'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/rest-client-1.7.2/lib/restclient/request.rb:176:in `execute'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/rest-client-1.7.2/lib/restclient/request.rb:41:in `execute'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/rest-client-1.7.2/lib/restclient.rb:65:in `get'
from (irb):10
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/ivan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Your RestClient.log
is set to true
. Find where that happens by intercepting the setter:
def RestClient.log=(value)
raise "HERE!"
end
then just wait till the exception is triggered, and see from the stack trace who assigns silly values. :)