部署在heroku上的rails 3.1项目出现问题
由于某种原因,我的项目中的 .js.coffee
文件没有通过 :remote => 调用true
links/forms
我正在尝试通过 Ajax 调用 posts/new
控制器。控制器正在被调用并执行,但它找不到重定向到的位置。
在日志中我收到以下消息:
ActionView:MissingTemplate(缺少模板 posts/new、application/new,带有 {: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
For some reason my .js.coffee
files in my project are not being called through the :remote => true
links/forms
I'm trying to call the posts/new
controller via Ajax. The controller is being called and executed but it can't find to where to redirect.
In the log I get the following message:
ActionView:MissingTemplate (Missing template posts/new, application/new with {:handlers => [:erb, :builders], :formats => [:js, :html], :locale => [:en, :en]}. searched in: * "/app/app/views"
When I change my new.js.coffee
file to new.js
it works fine. Any idea what to do so I can run Coffee script files too?
UPDATE
My 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的
gem 'coffee-rails'
行放在:assets
组之外,也许放在您的jquery-rails
gem 行之后。:assets
gem 在生产过程中不会被使用。Put your
gem 'coffee-rails'
line outside of the:assets
groups, maybe down after yourjquery-rails
gem line. The:assets
gems don't get used during production.