Project

General

Profile

Rails Dispatcher?

Added by n n over 13 years ago

Hi,

if i patch an existing model/controller in my init.rb i cant just load the patched files with

require_dependency 'issue_patch'

instead i have to do

Dispatcher.to_prepare do
require_dependency 'issue_patch'
end

could someone explain why?

i found this explanation for the to_prepare method:

"Add a preparation callback that will run before every request in development mode, or before the first request in production."

but i dont really understand what the difference is between loading them with and without to_prepare

bye