Ben Cai
2013-May-09 17:26 UTC
Rails 4.0.0.rc1 - A copy of <class> has been removed from the module tree but is still active!
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? [1] https://groups.google.com/forum/?fromgroups=#!searchin/rubyonrails-talk/%22been$20removed$20from$20the$20module%22%7Csort:date/rubyonrails-talk/FH9A81VwgyM/15DU9__ML9QJ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Dp93JCbV2GIJ. For more options, visit https://groups.google.com/groups/opt_out.