In my rails application inside lib/ folder I have many files I need to exclude one file from that lib folder to become eager_loading and remaining file should go eager_loading.
How can I achieve this?
config.eager_load_paths += %W[#{config.root}/lib/]In point 1, load all files from lib folder,
config.eager_load_paths -= %W[#{config.root}/lib/iq_analytics.rb]
config.eager_load = trueIn point 2, I have changed this to exclude
iq_analytics.rbthis file from loadingeager_load, but this line exclude all files from lib/ folder?
Any other way?
Rails >= 7.1
You can use config.autoload_lib(ignore:)
Rails < 7.1 and zeitwerk enabled