Alexandre Bini
unread,Aug 8, 2009, 5:47:41 PM8/8/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dr Nic's Magic Models
When i try to save 2 employes with a nil register, i´ve the
ActiveRecord::RecordInvalid: Validation failed
I have the following migrate
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
t.string :register, :null=>true, :limit=>12, :default=>nil
end
add_index :employees, :register, :unique=>true
end
def self.down
drop_table :employees
end
end
if i remove from the model the generate_validations and add it
validates_uniqueness_of :rg, :allow_nil=>true, :allow_blank=>true
validates_uniqueness_of :cpf, :allow_nil=>true, :allow_blank=>true
that work...
What i can do?