I cannot seem to find any information on this.
In my app folder (where I have models, views, controllers folders etc) I created a subdirectory app/data where I put about 10,000 files. After that, my Rails development server was incredibly slow.
What is the reason for this? Can I configure Rails to ignore certain files/folders? I take it it's to do with the dynamic nature of Ruby/Rails?
If you add a dir directly under app/
, all files in this dir are eager loaded in production and lazy loaded in development by default.
Try adding this in config/initializer.rb
:
path = Rails.root + "app/data"
ActiveSupport::Dependencies.autoload_paths -= [path.to_s]
This is to remove add/data
from autoload path.
Well, previous answer is correct, but as for me it's better to put this stuff somewhere else, because it's definitely not application code and, for example, it shouldn't be added to git.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With