José Valim
unread,Jul 30, 2008, 10:48:33 AM7/30/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Core
On Rails::Initializer, configuration.load_once_paths is frozen but
config.load_paths is not.
We need to freeze them so future modifications will fail rather than
do nothing mysteriously. For example, I was changing the variable on
my environment/development.rb and the path I was setting was never
loaded.
To fix, just add the line:
configuration.load_paths.freeze
To railties/lib/initializer.rb, method set_autoload_paths, around line
214.
So we will have:
def set_autoload_paths
Dependencies.load_paths = configuration.load_paths.uniq
Dependencies.load_once_paths = configuration.load_once_paths.uniq
extra = Dependencies.load_once_paths - Dependencies.load_paths
unless extra.empty?
abort <<-end_error
load_once_paths must be a subset of the load_paths.
Extra items in load_once_paths: #{extra * ','}
end_error
end
# Freeze the arrays so future modifications will fail rather than
do nothing mysteriously
configuration.load_paths.freeze
configuration.load_once_paths.freeze
end