How to add new view to Ruby on Rails Spree commerce app?

人盡茶涼 提交于 2019-11-30 09:48:46

You need to do in routes.rb:

Spree::Core::Engine.routes.prepend do
  get '/about', :to => 'about#index', :as => :about
end

or without the Spree::Core scope:

get '/about', :to => 'spree/about#index', :as => :about

Because, you have your about_controller.rb i.e. AboutController defined inside Spree module. And, hence you'll have to reference the spree namespace in your route to set it properly.

In your views:

<li id="about-link" data-hook><%= link_to Spree.t(:about), spree.about_path %></li>

or

<li id="about-link" data-hook><%= link_to Spree.t(:about), main_app.about_path %></li>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!