【问题标题】:In Ruby on Rails, cannot render :controller => 'generic', :action => 'top_pages' but need to use :template => 'generic/top_pages'?在 Ruby on Rails 中,无法渲染 :controller => 'generic', :action => 'top_pages' 但需要使用 :template => 'generic/top_pages'?
【发布时间】:2010-09-21 03:08:45
【问题描述】:

:controller 选项似乎没有任何作用?指定整个路径不会比使用:controller 指定低一点吗?

【问题讨论】:

    标签: ruby-on-rails controller rendering action


    【解决方案1】:

    据我所知,我检查了documentation,没有:controller 选项,我认为它只是被忽略了。

    另外,我相信它是一个较短的符号。如果你比较

    :template => 'controller/action'
    

    :controller => 'controller', :action => 'action'
    

    很明显(至少对我而言)它具有相同的含义。 此外,这更通用,因为有时控制器(和视图)是嵌套的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      相关资源
      最近更新 更多