Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – Rails 3.1升级后的ActionView :: MissingTemplate大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在升级到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

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails – Rails 3.1升级后的ActionView :: MissingTemplate全部内容,希望文章能够帮你解决ruby-on-rails – Rails 3.1升级后的ActionView :: MissingTemplate所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。