solidus icon indicating copy to clipboard operation
solidus copied to clipboard

Custom Acronym for UI breaks other gems/engines

Open brandonjyuhas opened this issue 1 year ago • 7 comments

Solidus has a custom inflection acronym for "Ui" (changing it to "UI"). This is correct in how UI is used. However, this means that other engines which use the default inflection ("Ui") are broken by default.

This means that to use another gem (such as Maglev), you need to monkeypatch their gem to rename the module.

Defining the inflection of a commonly used acronym within in apps codebase seems entirely outside of the scope of what Solidus provides, and I should be able to use Solidus without it changing the names of constants coming from other gems.

Solidus Version: 4.4.0

To Reproduce

Define a module using the default inflection for ui, "Ui". Alternatively, use a gem (such as Maglev). Note that it cannot be included in any class.

Current behavior Constants including the default inflection for ui cannot be loaded.

Expected behavior The default inflection for 'ui' is respected.

Screenshots

Image

Desktop (please complete the following information):

  • OS: OSX
  • Browser: Chrome
  • Version 131.0.6778.265 (Official Build) (arm64)

brandonjyuhas avatar Jan 15 '25 19:01 brandonjyuhas

@elia will have to tell you if this needs to be or if it was only a quality of life change https://github.com/solidusio/solidus/commit/5e719dbc8e8ab7738fd80981cd4da3e1f6055efd

fthobe avatar Jan 31 '25 20:01 fthobe

@rainerdema was this a quality of life change or something that was inevitable?

fthobe avatar Feb 08 '25 19:02 fthobe

This is a pesky issue, but it's a sensible request. I wonder if there's a way to inflect UI for a specific namespace, otherwise makes total sense to just go with the default inflection.

elia avatar Feb 10 '25 09:02 elia

@elia Would it break anything significant to rework that change?

The commit says:

Add an inflection to consider "UI" as an acronym
The DRY.rb container needs to be connected manually to Rails
inflections otherwise it will use its own and render "UI" as "Ui".

Co-Authored-By: Rainer Dema <[email protected]>

but I am having a hard time to understand the full impact here.

fthobe avatar Feb 10 '25 15:02 fthobe

@fthobe @brandonjyuhas would any of you be open to look into https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#customizing-inflections and send a PR fixing it?

I think we can and should strive to keep UI for solidus without disrupting the outside world.

elia avatar Feb 10 '25 15:02 elia

@elia and just like that Elia brought ravage to another community unprepared for @fthobe 💃

fthobe avatar Feb 10 '25 15:02 fthobe

@jhawthorn @amatsuda do you think it makes sense to touch this? We are unsure if we should align with rails or rails or rails should align with us here.

fthobe avatar Feb 10 '25 16:02 fthobe