I have a model with a unique index at the db level and model validation checking for uniqueness scoped to multiple columns.
# db level
add_index :table1, %i[fk_belongs_to_id col1 col2 col3 col4], unique: true
# model level
validates :fk_belongs_to_id, uniqueness: { scope: %i[col1 col2 col3 col4], case_sensitive: false }
In the spec I have:
it { should validate_uniqueness_of(:fk_belongs_to_id).scoped_to(%i[col1 col2 col3 col4).ignoring_case_sensitivity }
But I keep getting this error:
NoMethodError:
undefined method `all' for Symbol:Class
How can I test for uniqueness scope with multiple columns?
I am unable to find anything that can help with this in their docs or anything. Thanks for any help!