I'm trying to validate my model through equal values occuring a number
of times on the same column. I think that I have to use a custom
validation, right? I tried to use it but had no success.
For example, that's the table:
class MyTest < ActiveRecord::Migration
create_table :mytest do |t|
t.column :name, :string
t.column :column1, :boolean
What I need is that when 2 records on the table 'mytest' had column1 =
TRUE (1), and we try to insert a new record with this condition
(column1 = TRUE), an error to this field be added. Please, can you
help me to find a solution for this? Any hint for the model file
Thanks for the help.