【问题标题】:Getting error while using RefineryCMS Blog route使用 RefineryCMS 博客路由时出错
【发布时间】:2014-03-05 02:20:01
【问题描述】:

我指示 config/routes.rb 使用 Refinery Blog 作为根目录:

root :to => "refinery/blog/posts#index"
mount Refinery::Core::Engine, :at => '/'

在 app/view/layouts/_header.html.slim 我正在尝试使用 blog_root 路由。例如:

= link_to (image_tag "/logo.gif"), blog_root, class: "brand"

我发出rake routes时会列出路线:

blog_root        /blog(.:format)      refinery/blog/posts#index

但是什么都没显示,系统报错:

undefined local variable or method `blog_root' for 
#<#<Class:0x00000005e62f80>:0x007fd7241d94c8>

另外,我试过blog_root_path,但也没有用。

在这种情况下我能做些什么?非常感谢!

【问题讨论】:

    标签: ruby-on-rails helpers refinerycms


    【解决方案1】:

    这对question/answer 很有帮助。

    我查看了主应用程序的 config/routes.rb 内部,并在 cmets 中写道'我们要求您不要在此处使用 :as 选项,因为 Refinery 依赖它是“炼油厂”的默认值'。

    所以,工作路线是refinery.blog_root_path

    【讨论】:

    • 是的,所有路径都需要以“refinery”为前缀。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多