-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Uninitialized constant error for IDENTITY/Undefined #73
Comments
Hey thanks for the report. Could you upgrade to dry-system 0.27.0 and see if this goes away? |
@solnic Yup. After update I see another error:
|
I am experiencing this error as well, but with |
@marian13 With full namespaces it works like a charm with next dry stack: gem 'dry-system', '~> 0.26.0'
gem 'dry-transaction', '0.13.3'
gem 'dry-transformer', '~> 0.1.1'
gem 'dry-validation', '~> 1.9' |
How can I reproduce this? I tried this and it worked:
|
@flash-gordon I believe we need to have |
@solnic Here is the place where app crushes: require 'bundler'
require 'dotenv'
require_relative './environment'
Dotenv.load('.env', ".env.#{System::Environment.current_env}")
require 'dry/system/container' # place where raised an error
require 'zeitwerk'
module System
class Container < Dry::System::Container
use :env, inferrer: -> { System::Environment.current_env.to_sym }
use :zeitwerk
configure do |config|
config.component_dirs.add('app') do |dir|
dir.instance = proc do |component|
component_type = ->(type) { component.identifier.include?(type) }
component.loader.constant(component) if %w[jobs mailers serializers].any?(&component_type)
end
end
config.component_dirs.add('lib') do |dir|
dir.instance = proc do |component|
component.loader.constant(component) if component.identifier.include?('services')
end
end
end
end
Import = System::Container.injector
end After bumping dry-system to 0.27.0 raised another error:
As I understend my propose with fix is wrong, right? |
You need to do |
Yup. It's works, thanks:
And sorry for mess. |
@bestwebua I'm glad that it works and no worries. This was a helpful report. I should add more info to the dry-system release notes. |
Describe the bug
Uninitialized constant error for
IDENTITY
/Undefined
due using short namespaces.To Reproduce
This issue appear in my project after
dry-system
version has been bumped from0.25.0
to0.26.0
(dry-core
has been bumped from0.8.1
to0.9.0
).Expected behavior
No errors here :)
My environment
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
2.3.23
0.9.0
PR
PR with fix this issue: #72
The text was updated successfully, but these errors were encountered: