这些是相关模型:
class Repository < ActiveRecord::Base
has_many :quizzes, :dependent => :destroy
has_one :key, :dependent => :destroy
accepts_nested_attributes_for :key, :quizzes
end
class Quiz < ActiveRecord::Base
belongs_to :repository
has_many :topics, :dependent => :destroy
accepts_nested_attributes_for :topics
end
这是我的路线:
GqAPI::Application.routes.draw do
resources :repositories do
resources :quizzes
end
resources :quizzes
resources :keys
resources :topics
resources :questions
end
当我尝试这个配置时,我得到了数据库中的所有测验,而不仅仅是我在尝试转到 /repositories/1/quizzes 时指定的 ID 的测验
关于为什么的任何想法?非常感谢您的时间