【问题标题】:Missing template application/refreshonline ERROR缺少模板应用程序/refreshonline 错误
【发布时间】:2013-12-17 16:36:29
【问题描述】:

我正在应用程序控制器类中编写一个方法

ApplicationController < ActionController::Base 
  protect_from_forgery

  def refreshonline 
  end

end

并将视图放在 app/views/layout/refreshonline.html.erb 这个文件只包含简单的 html

但是当我运行这个方法时它给了我错误Missing template application/refreshonline with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :coffee]}. Searched in: * "D:/bitnami/test/projects/online/app/views"

所以我将我的 html 文件放在正确的位置或需要放在其他地方??

【问题讨论】:

    标签: ruby-on-rails-3.2


    【解决方案1】:

    如果您将 refreshonline.html.erb 上移一级到视图文件夹中,这将起作用。

    最好为资源添加一个新控制器并将视图移动到同名文件夹 (see here for reference)。

    【讨论】:

      猜你喜欢
      • 2015-09-08
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-08
      • 1970-01-01
      相关资源
      最近更新 更多