我正在尝试通过rails控制台更新记录并收到回滚错误:
Project.find(118).update_attributes(:featured=>true) Project Load (2.6ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT 1 [["id",118]] (2.8ms) BEGIN (1.3ms) ROLLBACK => false
解决方法
您的Project实例可能无效.要查看阻止保存的错误,您可以键入:
project = Project.find 118 project.assign_attributes(featured: true) project.valid? project.errors.full_messages