Created
September 11, 2019 14:18
-
-
Save skflowne/adcba66362af87f5966c478a4f6d3961 to your computer and use it in GitHub Desktop.
Autoloading modules from lib directory in Rails 3/4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's say we want a Shipping module | |
config.autoload_paths << Rails.root.join('lib', 'shipping') | |
# Then it's all about naming conventions | |
# In lib/shipping/shipping.rb | |
module Shipping | |
end | |
# Then let's say you want a Client class that will be accessible through Shipping::Client | |
# In lib/shipping/client.rb | |
class Client | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment