I believe everything under app/models is loaded by default, so you
shouldn't need to add a subdirectory.

Allen Madsen
http://www.allenmadsen.com

On Fri, Feb 24, 2017 at 10:49 AM, Maurizio De Santis <
[email protected]> wrote:

> [From the issue I opened about it: https://github.com/rails/
> rails/issues/28152]
>
> I don't know if this is more a bug report or a feature request, or even an
> SO question [image: :flushed:] anyway:
>
> I have a model Activity which has a lot of sti types, so a lot of related
> class files. I would like to organize them into app/models/activities, in
> order to separate them from the other models. I can actually accomplish it
> using config.eager_load_paths += %W(#{config.root}/app/models/activities)
> directive, but then in development mode the following exception is raised:
>
> ArgumentError: A copy of SubFolderModel has been removed from the module tree 
> but is still active!
>
> I guess the reason is that app/models/subfolder conflicts with app/models
> autoload. Anyway, is there a way to organize models using different
> directories?
>
> Steps to reproduce
>
>    - Create an app/models subfolder
>    - Put some models inside
>    - Add config.eager_load_paths += %W(#{config.root}/app/models/
>    subfolder) to config/application.rb
>    - Start the application in development mode
>
> Expected behavior
>
> Everything works fine
>
> Actual behavior
>
> Sometimes the following exception is raised:
>
> ArgumentError: A copy of SubFolderModel has been removed from the module tree 
> but is still active!
>
> System configuration
>
> *Rails version*: 5.0.1
>
> *Ruby version*: 2.4.0
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to