Memo
TL;DR
config/application.rb
...
config.eager_load_paths += ["#{Rails.root}/lib"]
...
Reference article: https://stackoverflow.com/questions/3282655/ruby-on-rails-3-reload-lib-directory-for-each-request
Deleted because require is no longer needed.
Since it is done only during development, write as follows to prevent it from being read every time in production.
config/application.rb
...
config.eager_load_paths += ["#{Rails.root}/lib"] if Rails.env.development?
...
Caller
require './lib/invoice_pdf' unless Rails.env.development?