【发布时间】:2012-02-05 14:55:50
【问题描述】:
我在生产中使用 Ruby 1.9.3p0、Rails 3.1.2 和 Apache 和 Passenger。当我尝试创建一个远程函数时,它会抛出这个错误:
ActionView::MissingTemplate (Missing template video/loadVideo, application/loadVideo with
{:handlers=>[:erb, :builder], :formats=>[:js, "application/ecmascript", "application/x-
ecmascript", :html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml,
:multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]}. Searched in
如您所见,:coffee 没有处理程序,这就是不处理文件 video/loadVideo.js.coffee 的原因;我运行命令 rake assets:precompile 但没有任何变化。
宝石文件 来源“http://rubygems.org”
gem 'rails', '3.1.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'will_paginate', '~> 3.0'
gem "bcrypt-ruby", :require => "bcrypt"
gem 'mysql'
#Problems in Debian, the error was:
#Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs #for a list of available runtimes. (ExecJS::RuntimeUnavailable)
#Solution: http://stackoverflow.com/questions/6282307/rails-3-1-execjs-and-could-not-find-a-javascript-runtime
gem 'execjs'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5.rc.2'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', '0.8.2', :require => false
end
【问题讨论】:
-
里面有 coffee-rails gem 并不意味着它提供了一个咖啡处理器。
-
请不要对模板使用驼峰式大小写。 Rails 的约定是使用下划线。
loadVideo模板应该是load_video。
标签: ruby-on-rails-3 coffeescript passenger