i''d gone through the tutorial in agile web dev for building an application and i noticed for the user table, if you entered the same user a new id would be assigned and the name would be duplicated. in other programming experience i''d keep the user table with no duplicates, but still use the existing id in join tables. for instance a table of authors. that would have no duplicates, but each time an article of an author was written the existing authors id would be assigned to the article id in a join table. is there a validation method or a similar process for doing this in rails? Todd _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
You can enforce unique users in your table using ''validates_uniqueness_of''. api.rubyonrails.com/classes/ActiveRecord/Validations/ClassMethods.html#M000658 Hammed On 26/11/05, tmatsumoto <tmatsumoto-hi6Y0CQ0nG0@public.gmane.org> wrote:> i''d gone through the tutorial in agile web dev for building an > application and i noticed for the user table, if you entered the same > user a new id would be assigned and the name would be duplicated. in > other programming experience i''d keep the user table with no > duplicates, but still use the existing id in join tables. > > for instance a table of authors. that would have no duplicates, but > each time an article of an author was written the existing authors id > would be assigned to the article id in a join table. > > is there a validation method or a similar process for doing this in > rails? > > Todd > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails > > >