ruby在rails-3 – Rails 3咖啡处理程序丢失

前端之家收集整理的这篇文章主要介绍了ruby在rails-3 – Rails 3咖啡处理程序丢失前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Im使用 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

正如你所看到的,没有处理程序:咖啡,这就是为什么不处理文件视频/ loadVideo.js.coffee的原因;我运行命令rake assets:预编译,但没有改变.

宝石档案
来源“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: https://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

在开发环境应用程序默认情况下加载所有的gems:default,:development,:test,:assets groups.咖啡处理器来自咖啡轨道宝石,所以你必须加载它.

原文链接:https://www.f2er.com/ruby/265692.html

猜你在找的Ruby相关文章