title: Rails Validate Uniqueness Isn't Working
body: <p>Model Code (Attempting to require uniqueness for <code>embed_code</code>)</p>
  
  <p><a href="https://gist.github.com/1427851" rel="nofollow">https://gist.github.com/1427851</a>:</p>
  
  <pre><code>class Link &lt; ActiveRecord::Base
    validates :embed_code, 
              :format =&gt; {:with =&gt; /^&lt;object type|^&lt;embed src|^&lt;object width|^&lt;iframe src|^&lt;object height|^&lt;iframe width|^&lt;embed id|^&lt;embed width|^&lt;object data|^&lt;div|^&lt;object id/i, :message =&gt; "Invalid Input"}, 
              :uniqueness =&gt; true
    attr_accessible :title, :embed_code, :score
    after_initialize :calculate_score, :favs_count
    attr_accessor :score, :fav_count
    validates :title, :length =&gt; { :in =&gt; 4..45, :message =&gt; "Must be between 4 &amp; 45 characters"} 
  
  
    before_save :resize
  
    has_many   :favorites
    has_many   :favorited, :through =&gt; :favorites, :source =&gt; :user
    belongs_to :user
  </code></pre>
  
  <p>I've tried <code>validates_uniqueness_of :embed_code</code> and disabling (commenting out) non-critical components of the model such as <code>:before_save :resize</code></p>