Created
March 11, 2009 00:04
-
-
Save jacqui/77212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> u = Factory(:user) | |
ActiveRecord::StatementInvalid: Mysql::Error: Cannot add or update a child row: a foreign key constraint fails (`openmrs_development/users`, CONSTRAINT `user_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`)): INSERT INTO `users` (`salt`, `creator`, `date_created`, `voided`, `secret_answer`, `changed_by`, `secret_question`, `system_id`, `username`, `void_reason`, `date_changed`, `voided_by`, `first_name`, `date_voided`, `last_name`, `password`, `middle_name`) VALUES('ied6FQj8o8', 1, '2009-03-10 20:03:19', 0, NULL, NULL, NULL, 'Baobab Admin', 'mike1', NULL, '2009-03-10 20:03:19', NULL, 'Mike1', '2009-03-10 20:03:19', 'McKay1', '750bda64556e9178987072b329f4f8a53c37cb9d', NULL) | |
# factories.rb | |
Factory.define :user do |u| | |
u.salt { User.random_string(10) } | |
u.password { |a| User.encrypt(Sham.password, a.salt) } | |
u.date_created { Time.now.to_formatted_s(:db) } | |
u.date_changed { Time.now.to_formatted_s(:db) } | |
u.date_voided { Time.now.to_formatted_s(:db) } | |
u.voided false | |
u.username { Sham.username } | |
u.system_id "Baobab Admin" | |
u.first_name { Sham.first_name } | |
u.last_name { Sham.last_name } | |
u.creator 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment