So the question now was how to monkeypatch the entire Date::Format module? Simply
require
-ing it as a plugin doesn't work, since Date::Format is already loaded at that point. The trick then is to use load
instead of require.First, I tried this:
load 'date/format.rb'
(note: load needs the actual filename; it doesn't have the magic that require does) but that gave me an error:
in `load': wrong number of arguments (1 for 0) (ArgumentError)
Turns out Rails::Plugin::Loader defines its own
load
, so:
Kernel::load 'date/format.rb'
et voila!
No comments:
Post a Comment