无法找到 rails 关联模型

Unable to find rails association Model

我正在尝试通过连接点 table 进行查询,但 Rails 给出了以下错误

场地模型

class Venue < ActiveRecord::Base


attr_accessible :address, :latitude, :longitude, :name, :phone, :suburb, :state, :country
  after_validation :geocode

  has_many :orders, through: :venues_orders

  geocoded_by :full_address


  def full_address
    [address, suburb, state, country].compact.join(', ')
  end

end

订单型号

class Order < ActiveRecord::Base
  attr_accessible :fulfilled, :item, :placed, :person_id, :special_instructions, :priority, :flag, :milk

  belongs_to :person
  belongs_to :venue

场地订单模型

class VenuesOrders < ActiveRecord::Base
  attr_accessible :order_id, :venue_id
end
class Venue < ActiveRecord::Base

  has_many :orders, through: :venues_orders
  has_many :venues_orders   

end

class Order < ActiveRecord::Base

  has_many :venues, through: :venues_orders
  has_many :venues_orders   

end

class VenuesOrders < ActiveRecord::Base
  belongs_to :venue
  belongs_to :order
end

有关详细信息,请阅读:RailsGuides

另一个建议:创建 join table 的约定是词法排序。比如,OrdersVenues 而不是 VenuesOrders