Skip to content

Conversation

@nathanl
Copy link
Contributor

@nathanl nathanl commented Oct 8, 2025

No description provided.

@chrismccord
Copy link
Member

Do you need this for broader generator use or convenience for your own apps? Not opposed, just wondering if this is part of some larger work or not, but we also have to decide how much we want to place here if we're thinking about adding more utilities. THanks!

@nathanl
Copy link
Contributor Author

nathanl commented Oct 8, 2025

Convenience in an app. My current example: converting the snake case atoms of an Ecto enum type, like :deep_freezer, into a form select option. "Deep Freezer" looks more like an expected dropdown value to me than "Deep freezer". Personally I want something like this more often than humanize/1, but maybe that's just me.

Comment on lines +150 to +155
bin =
if String.ends_with?(bin, "_id") do
binary_part(bin, 0, byte_size(bin) - 3)
else
bin
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the API could be similar to one provided in Rails? https://apidock.com/rails/String/humanize
(I mean the keep_id_suffix part)

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.

3 participants