Skip to content

Instantly share code, notes, and snippets.

View Abdulrazak-Alkl's full-sized avatar

Abdul Razzak Alkel Abdulrazak-Alkl

View GitHub Profile
@maxivak
maxivak / __readme.md
Last active January 19, 2024 15:00
Load code in libraries in Rails 5

Load lib files in production (Rails 5)

If you have your code defined in classes in lib/ folder you may have problems to load that code in production.

Autoloading is disabled in the production environment by default because of thread safety.

Change config/application.rb:

    config.autoload_paths << Rails.root.join("lib")
 config.eager_load_paths &lt;&lt; Rails.root.join("lib")