1

I have an application that interacts with ActiveResource from a system I have no control of.

It happens that the system sends me a JSON feed and one of the fields is called "type" and, everytime this model is serialized, I get this nasty exception. Since this is a CLI application, it's very annoying.

Is there a way to silence this warning?

kolrie
  • 12,562
  • 14
  • 64
  • 98

1 Answers1

3

Here's one way to silence warnings in certain parts of code:

def silently(&block)
  warn_level = $VERBOSE
  $VERBOSE = nil
  begin
    result = block.call
  ensure
    $VERBOSE = warn_level
  end
  result
end

silently do
  #do your thing
end
Skilldrick
  • 69,215
  • 34
  • 177
  • 229