Hi in my development build using sqlite3, I specified email in my Account model to be a unique index as shown below, so why it the db happy adding the same emails? this type of insert should fail!
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
t.string :email, :null=>false, :limit=>60
t.index :email, :unique=>true
I know about 'validates_uniqueness_of :email', but this check happen at the rails level, I wanted also something at the db level. I know sqlite3 supports unique indexing, so what's wrong?
Hi in my development build using sqlite3, I specified email in my Account model to be a unique index as shown below, so why it the db happy adding the same emails? this type of insert should fail!
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
t.string :email, :null=>false, :limit=>60
t.index :email, :unique=>true
Hi in my development build using sqlite3, I specified email in my Account model to be a unique index as shown below, so why it the db happy adding the same emails? this type of insert should fail!
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
t.string :email, :null=>false, :limit=>60
t.index :email, :unique=>true