You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In postgresql you can create partial indexes that allow you specify a where condition.
I was able to add a uniqueness validation that enforces these, using a combination of scope and conditions, e.g. validates_uniqueness_of :account_id, scope: :default, condition: -> { where(default: true}. This example enforces a single default per account. It would be awesome if the gem could identify these so that they aren't being flagged.
The text was updated successfully, but these errors were encountered:
In postgresql you can create partial indexes that allow you specify a where condition.
I was able to add a uniqueness validation that enforces these, using a combination of
scope
andconditions
, e.g.validates_uniqueness_of :account_id, scope: :default, condition: -> { where(default: true}
. This example enforces a single default per account. It would be awesome if the gem could identify these so that they aren't being flagged.The text was updated successfully, but these errors were encountered: