title: Can an attribute be normalized for all finder methods?
body: <p>Let's say I have a Rails 5 model with an attribute that needs to be normalized, like a url or email.</p>
  
  <pre><code>class Person &lt; ApplicationRecord
    # Using the attribute_normalizer gem
    normalize_attributes :email, with :email
  
    ...
  end
  </code></pre>
  
  <p>I want it so when finder methods are used on that model, that search attribute is also normalized. For example...</p>
  
  <pre><code># This would match 'foo@example.com'
  person = Person.find_by( email: 'FOO@EXAMPLE.COM' )
  
  # This would also match 'foo@example.com'
  person = Person.find_by( email: 'foo+extra@example.com' )
  </code></pre>
  
  <p>I tried providing my own <code>Person.find_by</code> thinking other finder methods would ultimately call it.</p>
  
  <pre><code>def self.find_by(*args)
    attrs = args.first
    normalize_email_attribute(attrs) if attrs.kind_of?(Hash) 
    super
  end
  </code></pre>
  
  <p>That worked for <code>Person.find_by</code>, but despite internally Rails using <code>find_by</code> for other finder methods like <code>find_or_create_by</code>, they don't call <code>Person.find_by</code>. I have to override individual finder methods.</p>
  
  <pre><code>def self.find_or_create_by(attrs, &amp;block)
    normalize_email_attribute(attrs)
    super
  end
  
  def self.find_or_create_by!(attrs, &amp;block)
    normalize_email_attribute(attrs)
    super
  end
  </code></pre>
  
  <p>Is there a way to normalize search attributes on a particular model for all finder methods? Or perhaps a better to accomplish the same thing?</p>