I upgrade an app from Rails 3.2.13 to Rails 4.0.0.rc1. After the
upgrade, I
started getting the error “A copy of Reference::Base has been removed
from
the module tree but is still active!” whenever a request is sent. This
error occurs only when after making any change (even adding/removing a
comment) to a source file and then sending a request. The error goes
away
after restarting the server but if I made a code change again and send a
request, the error would appear again.
This is what is in development.rb for reloading Reference::Base.
*config.to_prepare do
*
-
Reference::DataTypes.reload if
ActiveRecord::Base.connection.table_exists? ‘reference_data_lists’* -
end*
I found several other older posts that talk about this topic. One being
[1]. Adding “ActiveSupport::Dependencies.autoload_once_paths <<
“#{Rails.root}/app/models/reference/base”” to environment.rb does fix
the
issue for me. My question is why does this error occur when my app is
upgraded to Rails 4.0.0.rc1 but works fine when it was on Rails 3.2.13?
What is new in Rails 4.0.0.rc1 that causes this behavior?