I want to add validations, methods, etc. to a model that is defined inside a plugin. What's the best way to do this? Would it be safe to copy the model file to the app/models directory?
+1
A:
You can always go for monkey-patching in that way you don't have to touch the actual plugin. eg.
class YourModel
validate_uniqueness_of :some_field
end
this patch either you can write as plugin itself or just can be required before use.
serioys sam
2009-03-12 07:26:58
+1
A:
If the plugin is on github you may want to think about forking it and adding the changes.
Mike Breen
2009-03-13 18:21:39
Monkeypatching the model is ok, but if you can spend the time to fork the plugin, that's the best way to go :)
gsmendoza
2010-04-09 04:50:20