路径助手问题与命名路由有关

时间:2013-09-22 03:10:19

标签: ruby-on-rails routes

我正在使用以下控制器实现一个在rails应用程序中提供静态页面的系统:

class PagesController < ApplicationController
  def about
    render 'pages/about'
  end
end

我的路线设置如下:

get 'about', to: 'pages#about', as: :about

我可以访问www.example.com/about并正确呈现about内容,但如果我尝试在视图中的任何位置使用带有link_to的about_path帮助器,则会在about_path上出现未定义的方法错误。耙我的路线返回“关于GET /about(.:format)页面#about”

任何人都知道为什么这个助手没有注册?

1 个答案:

答案 0 :(得分:0)

这是与Spree集成引起的问题。以下链接提供了两种可行的解决方案。

Adding Routes to Rails' Spree E-Commerce

相关问题