rails 3.2仅在生产中使用ActionView MissingTemplate

cti*_*y79 8 production-environment ruby-on-rails-3.1 asset-pipeline ruby-on-rails-3.2

我有一个在开发模式下工作得很漂亮的应用程序.为了尝试在Webrick或Passenger/apache中进行测试,我的大多数网站都会加载,直到我尝试提交ajax表单.我已经正确使用了bundle install --deployment.我已正确预编译了我的资产.但由于某种原因,我在提交远程表单时遇到以下错误.请记住,ajax实际上正在工作,因为它在数据库中创建记录.我觉得有趣的一件事是我使用带有ruby 1.9.3的gemset但我在这些错误代码中得到了对ruby 1.9.1的引用.我还包括用户控制器,以便您可以看到控制器参考.救命!

更新!! 根据创建操作的动作,编辑操作更新操作或销毁错误缺少模板用户/创建或用户/更新或用户/编辑用户/销毁等.阅读第一个答案的评论,因为我认为这是一个jcomp文件未包含在预编译过程中的问题.

Started GET "/users/5" for 24.163.20.124 at 2012-02-07 03:30:09 -0500
Processing by UsersController#show as HTML
  Parameters: {"id"=>"5"}
Completed 500 Internal Server Error in 58ms

ActionView::MissingTemplate (Missing template users/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in:
* "/home/ctilley/Development/RatatouilleCatering/app/views"
* "/home/ctilley/Development/RatatouilleCatering/vendor/bundle/ruby/1.9.1/gems/wash_out-0.3.1/app/views"
* "/home/ctilley/Development/RatatouilleCatering/vendor/bundle/ruby/1.9.1/gems/ckeditor-3.7.0.rc2/app/views"
):
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/path_set.rb:58:in `find'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/lookup_context.rb:109:in `find'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/renderer/template_renderer.rb:28:in `determine_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/renderer/template_renderer.rb:10:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/renderer/renderer.rb:36:in `render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_view/renderer/renderer.rb:17:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/abstract_controller/rendering.rb:109:in `_render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/streaming.rb:225:in `_render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/abstract_controller/rendering.rb:103:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/abstract_controller/rendering.rb:88:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/rendering.rb:16:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
Run Code Online (Sandbox Code Playgroud)

控制器/ users_controller.rb

class UsersController < ApplicationController

  before_filter :require_user
  respond_to :html, :js
  load_and_authorize_resource
def index
  @users = User.search(params[:search]).order(sort_column + " " + sort_direction).paginate(:per_page => 10, :page=>params[:page])

   authorize! :read, @article
end

def show
end

def create
  @user = User.new(params[:user])

  if @user.save
  respond_with @user, :location => users_url
  end
end

def destroy
  @user = User.find(params[:id])
  @user.destroy

  respond_with @user, :location => users_url
end

def edit
  @user = User.find(params[:id])
  respond_with @user, :location => users_url
end

def update
  @user = User.find(params[:id])
  @user.update_attributes(params[:user])

  respond_with @user, :location => users_url
end
private
def sort_column
  params[:sort] || "id"
end
def sort_direction
   params[:direction] || "asc"
 end

end
Run Code Online (Sandbox Code Playgroud)

cti*_*y79 16

将以下内容移动到Gemfile中的资产组之外

gem 'coffee-rails', "~> 3.2.1"
gem 'uglifier', ">= 1.0.3"
Run Code Online (Sandbox Code Playgroud)

  • 对此有何解释? (2认同)