【发布时间】:2016-05-29 23:44:26
【问题描述】:
我对在我的 Rails 4 应用程序中实现反馈循环的尝试感到困惑。
我在这里提出了与此问题相关的问题:
Evaluation - polymorphic associations on feedback loop
我仍在尝试找出一般方法 - 以及这些问题的解决方案,但我有一个具体问题是关于如何设置与用户关联的模型。
我正在尝试销毁我的 rails 控制台中的所有用户,但是我因以下错误而停止:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column evaluations.evaluator_id does not exist
我认为这意味着我需要在我的评估表中添加一个“evaluator_id”列。
目前,该表有:
id :integer not null, primary key
user_id :integer
evaluatable_id :integer
evaluatable_type :string
overall_score :integer
continue_project? :boolean
created_at :datetime not null
updated_at :datetime not null
Indexes
index_evaluations_on_evaluatable_type_and_evaluatable_id (evaluatable_type,evaluatable_id) UNIQUE
在每种情况下,评估者都是用户的别名。用户也是评价的所有者。我不确定我是否真的需要将 evaluator_id 添加到用户,因为我的模型上已经有用户。
谁能看到我应该做些什么来解决这个问题?
【问题讨论】:
-
您在此处提供的表/模型是什么?
标签: ruby-on-rails polymorphism polymorphic-associations