Skip to content

Fix: qualify bare Faker constant references to support lazy loading#3253

Merged
stefannibrasil merged 1 commit intofaker-ruby:mainfrom
javier-menendez:lazy-load-fixes
Apr 27, 2026
Merged

Fix: qualify bare Faker constant references to support lazy loading#3253
stefannibrasil merged 1 commit intofaker-ruby:mainfrom
javier-menendez:lazy-load-fixes

Conversation

@javier-menendez
Copy link
Copy Markdown
Contributor

@javier-menendez javier-menendez commented Apr 24, 2026

Motivation / Background

Prefix unresolved calls to Number, Date, Lorem, and Time with Faker:: in Code, Crypto, Omniauth, and Types so they resolve correctly when FAKER_LAZY_LOAD=1 defers autoloading

Generators failing with lazy enabled

Faker::Code.nric
Faker::Code.rut
Faker::Crypto.md5
Faker::Crypto.sha1
Faker::Crypto.sha256
Faker::Omniauth.apple
Faker::Omniauth.auth0
Faker::Omniauth.facebook
Faker::Omniauth.github
Faker::Omniauth.google
Faker::Omniauth.linkedin

Example to reproduce

FAKER_LAZY_LOAD=1 bundle exec irb
irb(main):001> require 'faker'
=> true
irb(main):002> Faker::Code.nric
/home/user/faker/lib/faker/default/code.rb:95:in 'Faker::Code.nric': undefined method 'birthday' for class Date (NoMethodError)

Prefix unresolved calls to Number, Date, Lorem, and Time with Faker::
in Code, Crypto, Omniauth, and Types so they resolve correctly when
FAKER_LAZY_LOAD=1 defers autoloading
@stefannibrasil
Copy link
Copy Markdown
Contributor

Thanks!

@stefannibrasil stefannibrasil merged commit 8108960 into faker-ruby:main Apr 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants