You can use :scope
   validates_uniqueness_of :first_name, :scope => :last_name
If your database is huge, indexing last_name will help. Read more here:
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html

Thanks,
Abhinav
--
अभिनव
http://twitter.com/abhinav



On Tue, Sep 8, 2009 at 9:59 AM, Anh Hung Nguyen <[email protected]> wrote:
>
> Hi,
>
> I have a form that asks users to put in their :first_name and :last_name.
How do I validate that their full_name (first_name + last_name) is unique?
>
> Thanks!
>
> Nguyen Anh Hung
> Assistant Project Manager/ Consultant/ Business Analyst
> Tech Propulsion Labs
> Mobile: +84987 005 477
> Twitter: http://www.twitter.com/anhhung
> Blog:    http://www.fresco20.com
> Skype: anhhung.n | Yahoo: hero.tuxer | Gtalk: anhhung
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to