mdeering / attribute_normalizer

Adds the ability to normalize attributes cleanly with code blocks and predefined normalizers
MIT License
475 stars 53 forks source link

Use attribute_missing instead of super #81

Closed michaelsauter closed 4 years ago

michaelsauter commented 6 years ago

Using Rails 5, +super+ does not work and results in:

NoMethodError: super: no superclass method <attribute>= ...

This change just copies https://github.com/rails/rails/blob/v5.1.4/activemodel/lib/active_model/attribute_methods.rb#L431-L432 from +method_missing+.

I guess this is not the change you want to make in this gem, but it was the easiest fix for the app I'm working on and I thought I'll open the PR here anyway as an example. Also - where we use attribute_normalizer we do a lot of weird things so this error might be caused by some of that stuff as well.

zocoi commented 6 years ago

👍 cc @mdeering

mdeering commented 4 years ago

Breadcrumb for those that end up here in the future.

we do a lot of weird things so this error might be caused by some of that stuff as well

Have many production apps running Rails 5 && Rails 6 with heavy attribute_normalizer use without issue. I would chalk this up to doing weird things