繁体   English   中英

Rails 3咖啡处理器丢失

[英]Rails 3 Coffee Handler Missing

我使用Ruby 1.9.3p0,Rails 3.1.2与Apache和Passenger in Production。 当我尝试创建一个远程函数时,它会抛出这个错误:

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但没有任何变化。

Gemfile源'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

更改您的Gemfile(在资产组外移动coffee-rails gem)或更改您的application.rb设置 - 例如

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  # Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  Bundler.require(:default, :assets, Rails.env)
end

在开发环境中,应用程序默认从:default, :development, :test, :assets加载所有gem :default, :development, :test, :assets groups。 咖啡处理器来自coffee-rails gem,因此您必须加载它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM