Skip to content

Fix Rails 8.1 deprecation#151

Merged
yads merged 2 commits intomongoid:masterfrom
stanley90:rails-deprecations
Jan 29, 2026
Merged

Fix Rails 8.1 deprecation#151
yads merged 2 commits intomongoid:masterfrom
stanley90:rails-deprecations

Conversation

@stanley90
Copy link
Contributor

Remove deprecated call of mb_chars.
Not sure if we should check the Rails version to ensure this gem still works with older versions?

@dblock
Copy link
Contributor

dblock commented Jan 29, 2026

The gem doesn't know anything about Rails AFAIK, but what breaks with an older version? Any way to write a test that shows it and run tests with older versions of rails?

@stanley90
Copy link
Contributor Author

Yes the gem doesn't explicitly depend on Rails, but if I'm not mistaken, mb_chars exists only in ActiveSupport, so in reality it is a (undeclared) dependency.
Just checked that the next method in the call chain - unicode_normalize seems to exist since about Ruby 2.2, so either it's not really worth checking anything, or to make it super safe, the check could be something along:
text.to_s.respond_to?(:unicode_normalize) ? text.to_s.unicode_normalize : text.to_s.mb_chars.unicode_normalize

@dblock
Copy link
Contributor

dblock commented Jan 29, 2026

I think it's fine just removing it. Update CHANGELOG?

@github-actions
Copy link

Danger Report

No issues found.

View run

@yads yads merged commit 7641ef5 into mongoid:master Jan 29, 2026
11 checks passed
@stanley90 stanley90 deleted the rails-deprecations branch January 29, 2026 20:05
@stanley90
Copy link
Contributor Author

Thanks for merging. Can we get a release pls?

@yads
Copy link
Collaborator

yads commented Feb 2, 2026

0.5.0 published

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