gpt4 book ai didi

ruby-on-rails-3 - Rails 3 Coffee Handler丢失

转载 作者:行者123 更新时间:2023-12-04 03:33:47 25 4
gpt4 key购买 nike

我在生产中使用的是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 asset:precompile ,但没有任何变化。

gem 文件
来源'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(将咖啡栏上的 gem 移到 Assets 组之外)或更改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。咖啡处理程序来自 coffee-rails gem,因此您必须加载它。

关于ruby-on-rails-3 - Rails 3 Coffee Handler丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8782224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com