validates_uniqueness_of and Multiple Columns

Use :scope

  validates_uniqueness_of :first_name, :scope => :last_name

An index on last_name would be appropriate as well if this table is large.

I've never done this, but I think I would like to write a composed_of
object (FullName maybe?) and define some validation on that.

class User < ActiveRecord::Base
  composed_of :full_name, :mapping => %w(first_name last_name)

  def validate
    errors.add_to_base("Name must be unique") unless full_name.unique?
  end
end

I like how that expresses the intent so clearly.

Pat