How to undefine class in Ruby?

Viewed 22723

Undefining a method in Ruby is pretty simple, I can just use undef METHOD_NAME.

Is there anything similar for a class? I am on MRI 1.9.2.

I have to undefine an ActiveRecord Model, run two lines of code, and restore the model back to its original form.

The problem is, I have an model Contact and I am using a company's API and it happens that they have some class called Contact, and changing my model name would be lot of work for me.

What can I do in this situation?

2 Answers
Related