I would like to validate the uniqueness of two columns together. I have last and first names as separate columns. What is the Rails Way to do this? Thanks, Jared Nuzzolillo _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I am using this, but I am not sure if it is correct or if i am just getting lucky: validates_uniqueness_of :last, :scope => "first" validates_uniqueness_of :first, :scope => "last" Please let me know :-) On 10/21/05, Jared Nuzzolillo <onceuponapriori-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I would like to validate the uniqueness of two columns together. I have > last and first names as separate columns. What is the Rails Way to do this? > > Thanks, > Jared Nuzzolillo >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I think one of those would be enough. Kent. On Fri, 2005-10-21 at 01:13 -0400, Jared Nuzzolillo wrote:> I am using this, but I am not sure if it is correct or if i am just > getting lucky: > > validates_uniqueness_of :last, :scope => "first" > validates_uniqueness_of :first, :scope => "last" > > Please let me know :-) > > On 10/21/05, Jared Nuzzolillo <onceuponapriori-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > I would like to validate the uniqueness of two columns > together. I have last and first names as separate columns. > What is the Rails Way to do this? > > Thanks, > Jared Nuzzolillo > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I think one of those should be enough. Kent. On Fri, 2005-10-21 at 01:13 -0400, Jared Nuzzolillo wrote:> I am using this, but I am not sure if it is correct or if i am just > getting lucky: > > validates_uniqueness_of :last, :scope => "first" > validates_uniqueness_of :first, :scope => "last" > > Please let me know :-) > > On 10/21/05, Jared Nuzzolillo <onceuponapriori-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > I would like to validate the uniqueness of two columns > together. I have last and first names as separate columns. > What is the Rails Way to do this? > > Thanks, > Jared Nuzzolillo > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks. It seems you are correct. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails