gpt4 book ai didi

ruby-on-rails - SQLite3::ConstraintException: UNIQUE 约束失败: users.email: INSERT INTO "users"

转载 作者:数据小太阳 更新时间:2023-10-29 08:30:00 26 4
gpt4 key购买 nike

我刚刚安装了 devise gem,但出现以下错误:

Error:
AccountsControllerTest#test_should_update_account:
ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2017-09-19 08:32:47.975048', '2017-09-19 08:32:47.975048', 298486374)

这是我遵循的程序:

gem 'devise'
bundle install
rails generate devise:install
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
rails generate devise user
devise_for :users, path: 'users'
config.scoped_views = true
rails g devise:views users
rails generate devise:controllers users

知道哪里出了问题吗?

最佳答案

我找到了解决方案!我不得不将 test/fixtures/users.yml 文件更改为:

one:
email: test1@test.com

two:
email: test2@test.com

关于ruby-on-rails - SQLite3::ConstraintException: UNIQUE 约束失败: users.email: INSERT INTO "users",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46295808/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com