i have a rails 5 app and some of my directories in app/
dont autoload. how do i set the app to automatically load stuff in directories like:
app/workflows
app/validators
whether it be specs or a real server?
i tried:
config.autoload_paths << Rails.root.join('app/*')
or
config.autoload_paths << Rails.root.join('app/validators')
but it doesnt work. how can i just load every file in app/
directory?
EDIT
one of the classes that i need to have manually loaded in specs:
module Validator
class Token < Base
validate :date_correctness
def initialize(decoded_auth_token: decoded_auth_token)
@expiration_date = decoded_auth_token[:expiration_date]
end
private
attr_reader :expiration_date
def date_correctness
return true if Date.parse(expiration_date) >= Date.today
errors.add(:token, 'is expired')
end
end
end
app/validators/token.rb