Duplicates

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

You can enforce unique users in your table using
‘validates_uniqueness_of’.

http://api.rubyonrails.com/classes/ActiveRecord/Validations/ClassMethods.html#M000658

Hammed