normalize_attributes
normalize_attributes copied to clipboard
Feature Request: Inheritance of normalized attributes
Description
Single table inheritance models do not inherit normalized attributes. I would expect them to.
E.g.
class Animal < ActiveRecord base
normalize :name, :downcase
end
class Cat < Animal
end
class Dog < Animal
end
cat = Cat.new(name: "KITTY")
cat.save!
cat.name
# => "KITTY"
Describe the solution
One solution could be to implement inherited on the normalized model, so that it can pass on the normalized attributes to the child class.
Alternatives you considered
My workaround is to add the normalized attributed to each child class, which is ok, but prone to errors if one of them is updated.
Additional context
If this is indeed the intended behaviour, I can take a stab at creating a PR :)