When you monkey patch core classes you add to the core ruby apis.
Ruby monkey patch gem.
Ruby has a very beautiful syntax and so it can be tempting to monkey patch a class to turn some ugly method call into something that is more readable.
We can give mopsy new methods even after she has already been created.
It ensures that the monkey patching happens before the first request.
Monkey patching is the dangerous yet frequently useful technique of re opening existing classes to change or add to their behavior.
If you don t want the patch anymore just comment out that line.
This effect is similar to after initialize hook but ensures that monkey patching is reapplied in development mode after a reload in prod mode the result is identical.
There are many cases where it s fine to monkey patch but it should definitely not be your first weapon of choice.
Every app with core patches feels a little bit different.
Or perhaps you need to monkey patch a class you own.
We re in the future and with github and bundler there is now rarely a need to monkey patch ruby code in your applications.
Actually monkey patch datetime datetime.
Classes can be reopened at any time.
Monkey patching is so 2010.
Because ruby is an interpreted language objects are open and can be modified at runtime.
Instantly publish your gems and then install them use the api to find out more about available gems.