My understanding is that Rails is able to auto-load classes properly named within the app folder, by default.
It's not happening for me, so I want to see if you can find an obvious issue with my code.
My folders/files:
app
blueprints
concerns
ingredient_blueprint_concern.rb
liqueur_blueprint.rb
controllers
models
...
#app/blueprints/concerns/ingredient_blueprint_concern.rb
module Concerns
module IngredientBlueprintConcern
extend ActiveSupport::Concern
included do
attributes :name
end
end
end
# app/blueprints/liqueur_blueprint.rb
class LiqueurBlueprint < BaseBlueprint
include ::Concerns::IngredientBlueprintConcern
# ...
end
rails console:
> Concerns
=> NameError (uninitialized constant Concerns
Did you mean? Concurrent):
It seems related to the new Rails 6 zeitwerk mode. If I go back the the classic mode (with the code below), it seems to work fine:
# application.rb
config.autoloader = :classic