我刚刚升级到 1.0.3
,并且我的 config/routes 文件夹中的 routes.rb 文件似乎忽略了我所有的自定义路由。
我的路线.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
如果我运行
bundle exec rake routes
,它返回所有合适的路线。但是当我尝试访问该特定页面时,我得到:undefined local variable or method `about_us_path'
或者我的自定义路由中的每个链接都出现相同的错误。不知何故,我的路线被忽略了。有谁知道绕过这个问题的方法?
最佳答案
我遇到了同样的错误,发现this solution , 通过前缀 main_app
解决了它, 在每个 my_paths/_urls
之前.在我的例子中,这些是在 /override.rb
之一中使用的链接。文件。
所以,试试:main_app.about_us_path
.
关于ruby-on-rails - 为 Rails 的 Spree 电子商务添加路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10064533/