5

I followed commented guidelines in config/application.rb which is

   # Settings in config/environments/* take precedence over those specified here.
   # Application configuration should go into files in config/initializers
   # -- all .rb files in that directory are automatically loaded.

But when i added Rails.application.config.eager_load_paths << Rails.root.join('lib') in config/initializers/eager_load.rb.

It throws <top (required)>': can't modify frozen Array (RuntimeError)

Yes it is working if i put it inside config/application.rb.

I want to know why is it not working on initializer and how to make it work using the convention ?

Yana Agun Siswanto
  • 1,932
  • 18
  • 30

1 Answers1

2

Try this instead in config/initializers/xxx.rb:

Rails.application.config.eager_load_paths += [Rails.root.join('lib')] 
Weston
  • 461
  • 3
  • 8