加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails 3.1升级后的ActionView :: MissingTempl

发布时间:2020-12-16 21:11:42 所属栏目:百科 来源:网络整理
导读:在升级到Rails 3.1.0和 David Rice’s instructions之后,我的所有控制器都奇怪地找不到他们的意见了. # rails s #Started GET "/units" for 127.0.0.1 at 2011-09-04 07:52:23 -0400 Unit Load (0.1ms) SELECT "units".* FROM "units" ActionView::MissingTe
在升级到Rails 3.1.0和 David Rice’s instructions之后,我的所有控制器都奇怪地找不到他们的意见了.
# rails s #

Started GET "/units" for 127.0.0.1 at 2011-09-04 07:52:23 -0400
  Unit Load (0.1ms)  SELECT "units".* FROM "units" 

ActionView::MissingTemplate (Missing template units/index,application/index with {:handlers=>[:erb,:builder],:formats=>[:html],:locale=>[:en,:en]}. Searched in:
):
  app/controllers/units_controller.rb:9:in `index'

units_controller.rb:

# GET /units
  # GET /units.xml
  def index
    @units = Unit.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @units }
    end
  end

当然,视图在那里(/app/views/units/index.html.erb;它在升级之前工作).我觉得这是一个愚蠢的错误,我在这里错过了什么?

解决方法

您好像忘记在development.rb中删除以下行:

config.action_view.debug_rjs = true

不使用Rail Javascript时,应将其删除或注释掉.

有关升级的更多信息,请参阅rubyonrails.org上的“jQuery:New Default”
http://weblog.rubyonrails.org/2011/4/21/jquery-new-default

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读