Skip to content

Better naming for old_#{attribute} #65

@tmaier

Description

@tmaier

https://github.com/mdeering/attribute_normalizer/blob/master/lib/attribute_normalizer/model_inclusions.rb#L51-L57

          alias_method "old_#{attribute}=", "#{attribute}="

          define_method "#{attribute}=" do |value|
            normalized_value = self.send(:"normalize_#{attribute}", value)
            self.send("old_#{attribute}=", normalized_value)
          end

old_ is not a good naming scheme.

Better use something like attribute_without_attribute_normalizer and attribute_with_attribute_normalizer

Some resources showing this naming convention:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions