Hi all,

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
  def self.up
    create_table :mytest do |t|
      t.column :name, :string
      t.column :column1, :boolean
  end
  def self.down
    drop_table :products
  end
end

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
(mytest.rb)?


Thanks for the help.

--
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to