Ruby on rails ActiveRecord::存在许多与文档中所有内容相关的粗略关联NotFound错误问题

Ruby on rails ActiveRecord::存在许多与文档中所有内容相关的粗略关联NotFound错误问题,ruby-on-rails,ruby,activerecord,associations,Ruby On Rails,Ruby,Activerecord,Associations,以下是我的模型: class Client < ApplicationRecord has_many :client_authorization_rules has_many :projects, through: :client_authorization_rule end class Project < ApplicationRecord has_many :client_authorization_rules has_many :clients, thr

以下是我的模型:

class Client < ApplicationRecord

  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rule

end

class Project < ApplicationRecord

  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rule

end

class ClientAuthorizationRule < ApplicationRecord

  belongs_to :project
  belongs_to :client

  validates_presence_of :project
  validates_presence_of :client

end
这里的“p”是一个项目。我甚至无法访问项目上的“clients”方法,否则会出现以下错误:

ActiveRecord::HasManyThroughAssociationNotFoundError: Could not find the association :client_authorization_rule in model Project
不知道我错过了什么。谢谢我的Rails版本是Rails 5.0.6和ruby 2.2.3。这是已知的问题吗?我找不到有这个问题的人

通过::客户端授权规则

它应该是客户授权规则

class Client < ApplicationRecord

  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rules

end

class Project < ApplicationRecord

  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rules

end
通过::客户端授权规则

它应该是客户授权规则

class Client < ApplicationRecord

  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rules

end

class Project < ApplicationRecord

  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rules

end
跟随

class Client < ApplicationRecord

  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rule

end

class Project < ApplicationRecord

  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rule

end
类客户端
应该是

class Client < ApplicationRecord    
  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rules    
end

class Project < ApplicationRecord    
  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rules    
end
类客户端
注意:-
通过::客户授权规则应为
通过::客户授权规则

class Client < ApplicationRecord

  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rule

end

class Project < ApplicationRecord

  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rule

end
类客户端
应该是

class Client < ApplicationRecord    
  has_many :client_authorization_rules
  has_many :projects, through: :client_authorization_rules    
end

class Project < ApplicationRecord    
  has_many :client_authorization_rules
  has_many :clients, through: :client_authorization_rules    
end
类客户端

注意:-
通过::客户端授权规则
应该是
通过::客户端授权规则

Sheesh okay my bad。我想多元化很重要!嘘,好吧,我的错。我想多元化很重要!