我想将变量传递给部分路由。
有问题的模型如下所示:
model Foo < ActiveRecord::Base
has_many :dogs
has_many :cats
我想要的路径是:
<%= link_to "#{foo.name}", foo_dogs_path(foo) %>
<%= link_to "#{foo.name}", foo_cats_path(foo) %>
我想根据传入的变量 animal_type 使用“狗”或“猫”。我知道我需要使用多态路由,但我无法为这种场景制定语法。