module AttributesNormalizer extend ActiveSupport::Concern included do before_save :normalize_attributes end def excluded_normalized_attrs [] end def normalize_attributes self.attributes.each do |k, v| unless excluded_normalized_attrs.include?(k.to_sym) || !v.is_a?(String) self.send("#{k}=", v.mb_chars.upcase) end end end end