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

Consider using the Rails 7.1 normalizes API instead of before_validation callbacks #67

Open
rmm5t opened this issue Nov 30, 2023 · 2 comments
Labels

Comments

@rmm5t
Copy link
Owner

rmm5t commented Nov 30, 2023

Similar idea as #43

Investigate and perhaps consider using the new normalizes API in Rails 7.1 instead of a before_validation callback.

This would result in a major version bump for strip_attributes, but I would still like to attempt to maintain both forwards and backwards compatibility, to some extent possible.

@rmm5t rmm5t added the ideas label Nov 30, 2023
@tmaier
Copy link

tmaier commented Mar 24, 2024

Great idea, however, normalizes only works for ActiveRecord. I think this is a major blocker, unless you want to have two different versions to maintain. One for ActiveRecord and one for ActiveModel etc.

I opened a "feature request" in the ruby on rails forum. Maybe you want to support this (with a "hear" and/or a comment) https://discuss.rubyonrails.org/t/proposal-activemodel-normalization/85405

@tmaier
Copy link

tmaier commented Mar 24, 2024

There would be some benefits: The normalizes API overrides the setter - in addition to a before_validation. And it applies also for where clauses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants