如何在Ruby on Rails狂欢商务应用程序中添加新视图?

我似乎无法解决的一个非常基本的问题是如何向我的Ruby on Rails Spree商务应用程序添加新视图。 我想要做的是在_main_nav_bar.html.erb的主页链接旁边有一个链接,当你点击它时,在产品显示的地方显示了一个关于页面的页面。 所以:

home about cart --------------------- things of the HOME page --------------------- footer 

点击关于潜在客户:

 home about cart --------------------- things of the ABOUT page --------------------- footer 

在views / shared / _main_nav_bar.html.erb中,我创建的链接(基于主链接)如下所示:

   

我创建的AboutController看起来如下:

 module Spree class AboutController < Spree::StoreController def index end end end 

最后,在config / routes.rb中,我添加了以下代码:

 root :about => 'about#index' 

当我现在尝试启动服务器时,如果没有给出错误消息,它就不再起作用了。

有人可以帮我解决这个问题吗? 如何添加视图并创建在主div中加载的工作链接?

EXTRA:routes.rb

 MyStore::Application.routes.draw do mount Spree::Core::Engine, :at => '/' Spree::Core::Engine.routes.prepend do #get 'user/spree_user/logout', :to => "spree/user_sessions#destroy" end get '/about' => 'spree/about#index' get '/contact' => 'spree/contact#index' end 

你需要在routes.rb中做:

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

或没有Spree::Core范围:

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

因为,你有你的about_controller.rb即在Spree模块中定义的AboutController 。 因此,您必须在路由中引用spree名称空间以正确设置它。

在您的观点中:

  

要么