Skip to content
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

Dry::Core::Inflector loads ActiveSupport::Inflector #27

Closed
cllns opened this issue May 25, 2018 · 2 comments
Closed

Dry::Core::Inflector loads ActiveSupport::Inflector #27

cllns opened this issue May 25, 2018 · 2 comments

Comments

@cllns
Copy link
Member

cllns commented May 25, 2018

I'm adding Skylight.io to a Hanami app. It uses stuff from ActiveSupport, but they avoid using Core Extensions (monkey patches). So, ActiveSupport is available, but the Inflector isn't used for the normal application. (It is used for their CLI, but that's not being loaded here.)

The trouble is that, when Hanami uses a repository, it calls Dry::Core::Inflector.camelize(name) through ROM.

By itself, this should be fine, but Dry::Core::Inflector attempts to load 3 different back-end engines, in this order: ActiveSupport::Inflector, Dry::Inflector, Inflecto.

It first tries to require ActiveSupport::Inflector, which in this case succeeds, since activesupport is loaded. But, I don't actually want to load that :)

One way I was able to fix this was to change the order so dry-inflector is first, and add that to my Gemfile. This solves my problem, but I don't think we should be loading ActiveSupport::Inflector automatically. Some people use ActiveSupport without monkey patching, and we should encourage that. Maybe we could leverage it if it's already loaded, but not require it automatically here?

Related:

Happy to open a PR for this, just want to get everyone's thoughts before I move forward. I know this is an issue with ROM 3, since ROM 4 uses rom-support's Inflector, which is actually the apparent predecessor to the dry-core version I'm talking about now.

@cllns cllns changed the title Dry::Core::Inflector requires ActiveSupport::Inflector Dry::Core::Inflector requires ActiveSupport::Inflector May 25, 2018
@cllns cllns changed the title Dry::Core::Inflector requires ActiveSupport::Inflector Dry::Core::Inflector loads ActiveSupport::Inflector May 25, 2018
@cllns
Copy link
Member Author

cllns commented May 25, 2018

In the title I meant that it requires ActiveSupport::Inflector, but that ticks don't show up in the title so I changed it to "loads", since that's more of what I mean (even though it's the require keyword haha).

@solnic
Copy link
Member

solnic commented Apr 17, 2020

This is outdated so I'm gonna close it. ROM uses Dry::Inflector now.

@solnic solnic closed this as completed Apr 17, 2020
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

No branches or pull requests

2 participants