I would like to enhance existing class using instance_eval. There original definition contains validation, which require presence of certain fields, ie:
class Du
I had a similar problem and was able to get past it using:
class MyModel << Dummy
# erase the validations defined in the plugin/gem because they interfere with our own
Dummy.reset_callbacks(:validate)
...
end
This is under Rails 3.0. The caveat: It does remove ALL validations, so if there are others you want to keep you could try Dummy.skip_callback(...)
, but I could not figure out the right incantation of arguments to make that work.