更新时间:2022-06-22 02:41:39
我相信您对secretsanta表名的怀疑是正确的.
I believe you were right on in your suspicion about the secretsanta table name.
除非您在secretsanta模型上设置了table_name,否则Rails会查找名为secretsantas
的表.如果应用程序以前可以运行,我猜该表实际上名为secretsantas
.
Unless you've set a table_name on your secretsanta model, rails will look for a table named secretsantas
. If the application was working before, I'd guess that the table actually is named secretsantas
.
要列出可用表,请运行:
To list the available tables, run:
tables = ActiveRecord::Base.connection.tables
嗯,这是问题所在:
'Secretsanta'.pluralize
=> "Secretsanta"
尝试在模型中指定表名:
Try specifying the table name in your model:
class Secretsanta < ActiveRecord::Base
self.table_name = "secretsantas"
end