Ruby on rails 嵌套浅层资源
我想知道我是否为一个新的应用程序制作了正确的路由文件 其中我有以下模型:Ruby on rails 嵌套浅层资源,ruby-on-rails,ruby-on-rails-4,routes,Ruby On Rails,Ruby On Rails 4,Routes,我想知道我是否为一个新的应用程序制作了正确的路由文件 其中我有以下模型: class Member < ActiveRecord::Base belongs_to :employer has_many :dependents has_many :identities, as: :person end class Dependent < ActiveRecord::Base belongs_to :member has_many :identities, as: :pers
class Member < ActiveRecord::Base
belongs_to :employer
has_many :dependents
has_many :identities, as: :person
end
class Dependent < ActiveRecord::Base
belongs_to :member
has_many :identities, as: :person
end
class Identity < ActiveRecord::Base
belongs_to :person, polymorphic: true
end
我是按照人们认为有意义的方式做这件事,还是完全不正常;-)谢谢你的帮助 这是我所希望的。嵌套的浅层必须按预期将依赖项拉出
resources :members, shallow: true do
resources :identities
resources :dependents, shallow: true do
resources :identities
end
end