Change column in Rails to be unique
Simple two step process:
1: Create a migration
change_column :table_name, :column_name, :string, unique: true
2: Add validation in your model
validates_uniqueness_of :column_name
Simple two step process:
1: Create a migration
change_column :table_name, :column_name, :string, unique: true
2: Add validation in your model
validates_uniqueness_of :column_name