由于某种原因,我无法理解我做错了什么。保存项目时出错。我需要改变什么?
Active_cord :: HasManyThroughCantAssociateThroughHasOneOrManyReflection发生在user_boards#show:
无法修改关联'Project#todos',因为源反射类'Todo'通过:has_many与'List'相关联。
class Project < ApplicationRecord
has_many :lists, -> { order(position: :asc) }, dependent: :destroy
has_many :todos, through: :lists
has_many :labels, dependent: :destroy
has_many :todo_lists, -> { where('status = "active"').order(position: :asc) }, :class_name => 'TodoList', dependent: :destroy
class Todo < ApplicationRecord
belongs_to :list
acts_as_list scope: :list, add_new_at: :top
has_one :project, through: :list
class List < ApplicationRecord
belongs_to :project
has_many :todos, -> { order(position: :asc) }, dependent: :destroy
has_many :todo_lists, dependent: :destroy
has_many :active_todo_lists, -> { where('status = "active"').order(position: :asc) }, :class_name => 'TodoList'
has_many :active_todos, -> { where('status = "active"').order(position: :asc) }, :class_name => 'Todo'
acts_as_list scope: :project