Skip to content

Chapter 4 - autoload_path #19

@notapatch

Description

@notapatch

Chapter 4 autoload

Listing 5. lib/json_web_token.rb
# ...
module MarketPlaceApi
  class Application < Rails::Application
    # ...
    config.autoload_paths << Rails.root.join('lib')
  end
end

I notice you're using autoload. I find the area confusing. My understanding is autoloading lib was not threadsafe which is a problem with Puma in production and the suggestion was you should stick lib into app :-| I couldn't bring myself to do that and went with the other suggestion of changing autoload to eager load, which autoloads in development and eager loads, no requests until code loaded, in production.

https://stackoverflow.com/questions/19773266/confusing-about-autoload-paths-vs-eager-load-paths-in-rails-4?noredirect=1&lq=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions