Rails 5 ignoring /lib class?

In config/application.rb, change this:

config.autoload_paths << Rails.root.join('lib')

to this:

config.eager_load_paths << Rails.root.join('lib')

eager_load_paths will get eagerly loaded in production and on-demand in development. Doing it this way, you don't need to require every file explicitly.

See more info on this answer.


You need to add a 'require' (on application.rb) with your classes inside the lib folder.

Like:

require './lib/someclass'

I recommend you put it inside a Rails plugin.