由于某些原因,我的项目中的.js.coffee
个文件未通过:remote => true
链接/表单调用
我正试图通过Ajax调用posts/new
控制器。正在调用和执行控制器,但无法找到重定向的位置。
在日志中,我收到以下消息:
ActionView:MissingTemplate(缺少模板帖子/ new,application / new with {:handlers => [:erb,:builders] ,: formats => [:js,:html],:locale => [ :en,:en]}。搜索:*“/ app / app / views”
当我将new.js.coffee
文件更改为new.js
时,它可以正常工作。知道怎么做,我也可以运行Coffee脚本文件吗?
更新
我的Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3'
end
group :deployment do
gem 'pg'
end
gem 'devise', '1.4.9'
gem 'omniauth', '1.0.0'
gem 'omniauth-facebook'
gem 'rails_autolink'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
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', :require => false
end
答案 0 :(得分:6)
将gem 'coffee-rails'
行放在:assets
组之外,可能在jquery-rails
宝石线后面。生产过程中不会使用:assets
宝石。