这里的总新手^^所以我的页脚中有一堆静态页面,我想为其创建一条路线。现在,我正在使用 get 来创建这样的路线:
Rails.application.routes.draw do
root 'static_pages#home_page'
get 'static_pages/secret'
get 'static_pages/stripe_button'
get 'about_us', to: 'static_pages#about_us'
get 'rules', to: 'static_pages#rules'
get 'faq', to: 'static_pages#faq'
get 'community', to: 'static_pages#community'
get 'terms', to: 'static_pages#terms'
get 'privacy', to: 'static_pages#privacy'
end
理想情况下,我试图将所有这些浓缩成这样的资源:
resources :static_pages, only: [:index] do
get :terms, :community, :privacy, :rules, :faq, :about_us, :stripe_button, :secret
end
这是页面的页脚 li:
<div class="col">
<ul>
<li><%= link_to "About Us", 'about_us', class: 'nav-link d-inline-block' %></li>
<li><%= link_to "Rules", 'rules', class: 'nav-link d-inline-block' %></li>
<li><%= link_to "FAQ", 'faq', class: 'nav-link d-inline-block' %></li>
</ul>
</div>
<div class="col">
<ul>
<li><%= link_to "Community", 'community', class: 'nav-link d-inline-block' %></li>
<li><%= link_to "Terms", 'terms', class: 'nav-link d-inline-block' %></li>
<li><%= link_to "Privacy", 'privacy', class: 'nav-link d-inline-block' %></li>
</ul>
</div>
如何摆脱所有获取并将所有获取浓缩为一个资源?
红宝石 2.7.1 轨道 6.1.3
多谢 :)