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 << Rails.root.join("lib")