Tôi có một ứng dụng hoạt động tốt trong chế độ phát triển. Trong một nỗ lực để thử nghiệm trong sản xuất trong Webrick hoặc Hành khách/apache hầu hết các trang web của tôi tải tốt cho đến khi tôi cố gắng để gửi một mẫu ajax. Tôi đã sử dụng gói cài đặt --deployment đúng cách. Tôi đã biên dịch đúng tài sản của mình. Nhưng đối với một số lý do tôi nhận được lỗi sau khi gửi biểu mẫu từ xa. Hãy nhớ, ajax thực sự hoạt động vì nó đang tạo bản ghi trong cơ sở dữ liệu. Một điều tôi thấy thú vị là tôi đang sử dụng một gemset với ruby 1.9.3 nhưng tôi nhận được tham chiếu đến ruby 1.9.1 trong các mã lỗi này. Tôi cũng bao gồm bộ điều khiển Người dùng để bạn có thể xem các tham chiếu bộ điều khiển. Cứu giúp!đường ray 3.2 ActionView MissingTemplate chỉ trong sản xuất
Cập nhật !! Tùy thuộc vào hành động nào cho dù đó là hành động tạo, chỉnh sửa hành động cập nhật hành động hoặc phá hủy lỗi bị thiếu người dùng/tạo người dùng/cập nhật hoặc người dùng/chỉnh sửa người dùng/phá hủy v.v. Đọc nhận xét về câu trả lời đầu tiên vì tôi tin rằng đây là một vấn đề với các tập tin javascript không được bao gồm trong quá trình biên dịch trước.
Started GET "https://stackoverflow.com/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'
controllers/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
Bạn đã lưu ngày của tôi. – methyl
Cảm ơn bạn rất nhiều vì câu trả lời này. Tôi đã bối rối. –
Giải thích cho điều này là gì? – Lyudmil