title: Modifying value using before_validation before validate_uniqueness_of - SystemStackError: stack level too deep
body: <p>I'm trying to ensure the uniqueness of some urls we store in my app. 
  I want to strip them of their query parameters as these can change for the same url, and certain urls needs a slightly different stripping algorithm. </p>
  
  <p>I have a method (in an initializer)</p>
  
  <pre><code>def clean_url(url)
    domain = get_domain(url)
    case domain
    when "xyz.com" || "xyz.co.uk"
      url = url.split("&amp;")[0]
    when "abc.com"
      url = url.split("?")[0]
    end
  end
  </code></pre>
  
  <p>I want to call url_cleaner before_validation</p>
  
  <pre><code>thing.rb
  
  before_validation :url_cleaner
  validates_uniqueness_of :url
  
  def url_cleaner
    self.url = clean_url(self.url)     
  end
  </code></pre>
  
  <p>And I'm getting </p>
  
  <pre><code>SystemStackError: stack level too deep
  </code></pre>