title: Devise allow email uniqueness within scope
body: <p>I'm in the process of upgrading a large project from rails 2 to rails 3, as a part of that upgrade I'm replacing a very old restful_athentication with devise.</p>
  
  <p>The problem I'm having is that in the existing users table emails are validated like this.</p>
  
  <pre><code>validates_uniqueness_of :email, :scope =&gt; :account_id # No dupes within account
  </code></pre>
  
  <p>So if I add the index from the migration to add devise to users it WILL fail.</p>
  
  <p>Is there a way that I can use</p>
  
  <pre><code>add_index :users, [:email,:account_id]
  </code></pre>
  
  <p>And have devise work properly?</p>