Hi, I do not want to check a unique combination of 3 columns in my table.
Let's say I have a table called cars with the values: brand ,: model_name and: fuel_type.
What I want then is to check if the record is unique based on their combination. Example:
brand model_name fuel_type Audi A4 Gas Audi A4 Diesel Audi A6 Gas
All must be valid. But another record with "Audi, A6, Gas" should NOT be valid.
I know this check, but I doubt that she really does what I want.
validates_uniqueness_of :brand, :scope => {:model_name, :fuel_type}
ruby-on-rails ruby-on-rails-3
Niels Kristian Sep 15 2018-11-11T00: 00Z
source share