sean lynch wrote:
Could you post the text of your migration? or at least the portion for
the table in question.
Sure. I’ve had to remove and edit some data in the create statements for
reasons of privacy:
class CreatePeople < ActiveRecord::Migration
def self.up
create_table :people do |t|
t.column :name, :string, :null => false
t.column :short_name, :string
t.column :email, :string
t.column :internal_team_member, :boolean, :default => false
t.column :admin, :boolean, :default => false
# Authentication - for internal team members only
t.column :hashed_password, :string
t.column :salt, :string
t.column :created_at, :timestamp
t.column :modified_at, :timestamp
end
add_index :people, :name
add_index :people, :short_name
Person.create(:name => "Jeff LaMarche", :short_name => "Jeff",
:email => “[email protected]”, :internal_team_member => true,
:admin => true,
:password => “password”, :password_confirmation =>
“password”)
Person.create(:name => "Another Person", :short_name => "Becka",
:email => “[email protected]”, :internal_team_member => true,
:admin => false, :password => “password”,
:password_confirmation => “password”)
end
def self.down
drop_table :people
end
end
What happens is that the user “Jeff LaMarche” gets created, but the
second user does not. What does happen, if I trace the SQL is:
Person Load (0.000491) SELECT * FROM people WHERE (people.name =
‘Another Person’) LIMIT 1
Person Load (0.000427) SELECT * FROM people WHERE (people.short_name
= ‘Becka’) LIMIT 1
Person Load (0.000586) SELECT * FROM people WHERE (people.email =
‘[email protected]’) LIMIT 1
No insert happens, just the three selects above.
For the record, I’m on Mac OS X 10.4.7 running PostgreSQL 8.1.4 and
Rails 1.1.2
Thanks much in advance!
Jeff