对。这只是拒绝工作。一直在这几个小时。
专辑模特
class Album < ActiveRecord::Base
has_many :features, through: :join_table1
end
特征模型
class Feature < ActiveRecord::Base
has_many :albums, through: :join_table1
end
join_table1 模型
class JoinTable1 < ActiveRecord::Base
belongs_to :features
belongs_to :albums
end
join_table1 架构
album_id | feature_id
专辑架构
id | title | release_date | genre | artist_id | created_at | updated_at | price | image_path
特征模式
id | feature | created_at | updated_at
在获取测试数据库并运行此集成测试后:
require 'test_helper'
class DataFlowTest < ActionDispatch::IntegrationTest
test "create new user" do
album = albums(:one)
feature = features(:one)
album.features
end
end
我明白了
ActiveRecord::HasManyThroughAssociationNotFoundError:在模型相册中找不到关联:join_table1
为什么是这样?