Tuesday, April 8, 2008

Initializers in Merb

Note: A lot has been learned since I posted this. Please read the boot order post for more detailed information.

I was a fan of the config/initializers directory functionality recently added into Rails. I want it in Merb. So, to get this add the following into the Merb::BootLoader.before_app_loads block in config/init.rb.
Merb::BootLoader.before_app_loads do
Dir["#{Merb.root}/config/initializers/**/*.rb"].sort.each do |initializer|
require(initializer)
end
end

This code was taken from the Rails source (modified slightly of course).


back to Merb index

0 comments: