2
我有一个Country
:链接到散热片实现资源
mix phx.gen.html Location Country countries name slug:unique
链接到一个Country
我想用slug
而不是id
。我怎样才能实现这个代码将链接到slug
(例如http://localhost:4000/countries/germany
)?
<%= link "Show", to: country_path(@conn, :show, country), class: "btn btn-default btn-xs" %>
你尝试在'country_path'中使用'country.slug'吗? –