Tri*_*rip 15 ruby-on-rails spree
我刚刚升级到1.0.3,我的config/routes文件夹中的routes.rb文件似乎忽略了我所有的自定义路由.
我的routes.rb
JollyStore::Application.routes.draw do
# Mount Spree's routes
mount Spree::Core::Engine, :at => '/'
root :to => 'pages#index'
namespace :admin do
resources :wysiwygs
end
match 'about_us/', :to => "pages#about_us"
match 'services/', :to => "pages#services"
match 'raw_resources/', :to => "pages#raw_resources"
match 'contact_us/', :to => "pages#contact_us"
match 'privacy_policy/', :to => "pages#privacy_policy"
match 'return_policy/', :to => "pages#return_policy"
match 'refund_policy/', :to => "pages#refund_policy"
match 'cancellation_policy/', :to => "pages#cancellation_policy"
match 'delivery_shipping_policy/', :to => "pages#delivery_shipping_policy"
end
Run Code Online (Sandbox Code Playgroud)
如果我运行bundle exec rake routes,它将返回所有适当的路由.但当我尝试访问该特定页面时,我得到:
undefined local variable or method `about_us_path'
Run Code Online (Sandbox Code Playgroud)
或者我的自定义路由中的每个链接都有相同的错误.不知怎的,我的路线被忽略了.有没有人知道绕过这个问题的方法?
Sha*_*kar 19
您可以使用routes.rb文件中的以下块在Spree中添加新路由
Spree::Core::Engine.routes.prepend do
# Your new routes
end
Run Code Online (Sandbox Code Playgroud)
对我来说,前置不起作用.为我画画做了工作:
Spree::Core::Engine.routes.draw do
resources :orders, except: [:new, :create, :destroy] do
post :my_order, on: :collection
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9611 次 |
| 最近记录: |