validation - Rails validates_uniqueness_of, logical AND -
i have 3 paramaters, e.g. site_id_1
, site_id_2.
, transport_distance
when creating new record, rails should validate site_id_1
, site_id_2.
dont exist. (so combination matters)
with validates_uniqueness_of(:site_id_1, :site_id_2)
says site_id_1 or site_id_2 exist. i've tried: validates_uniqueness_of(:site_id_1 && :site_id_2)
doesnt helped me.
you should use scope
param of validates_uniqueness_of
validator:
validates_uniqueness_of :site_id_1, scope: :site_id_2
Comments
Post a Comment