I need to check the uniqueness of two fields in an object (string) before adding them. Employee_id and area_id are two fields in my emp_area table. There may be several records with the same employee_id and several records with the same domain_id, but no two records can have the same employee_id and the same area_id. This is similar to the two fields making up a primary key or a unique key.
How can i do this.
thank
how about this solution confirm combined values
validates :employee_id, uniqueness: { scope: :area_id }
validates_uniqueness_of :employee_id, :scope => :area_id