Javascript Heroku上的Ruby on Rails未呈现JS模板

Javascript Heroku上的Ruby on Rails未呈现JS模板,javascript,ruby-on-rails,heroku,render,Javascript,Ruby On Rails,Heroku,Render,我将我的应用程序部署到Heroku上的一个临时应用程序。它在本地运行100%良好 我有两个呈现JS的控制器。当我提交一个远程表单时,它将调用预期的操作并在其中执行代码。。。但它不是呈现JS模板。正在对操作中的数据库进行更改,但这就是应用程序停止的地方。这发生在渲染JS的两个控制器上。请记住,应用程序在本地开发模式下可以正常工作 我想知道我的应用程序配置是否与Heroku配合使用有关 以下是我的Heroku应用程序日志: 2013-02-01T20:17:17+00:00 app[web.1]:

我将我的应用程序部署到Heroku上的一个临时应用程序。它在本地运行100%良好

我有两个呈现JS的控制器。当我提交一个远程表单时,它将调用预期的操作并在其中执行代码。。。但它不是呈现JS模板。正在对操作中的数据库进行更改,但这就是应用程序停止的地方。这发生在渲染JS的两个控制器上。请记住,应用程序在本地开发模式下可以正常工作

我想知道我的应用程序配置是否与Heroku配合使用有关

以下是我的Heroku应用程序日志:

2013-02-01T20:17:17+00:00 app[web.1]: Started GET "/" for 68.230.151.152 at 2013-02-01 20:17:17 +0000
2013-02-01T20:17:17+00:00 app[web.1]:   Rendered blurbs/_show.html.slim (2.3ms)
2013-02-01T20:17:12+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:10)
2013-02-01T20:17:12+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:10)
2013-02-01T20:17:08+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e staging -p 23436`
2013-02-01T20:17:15+00:00 app[web.1]: >> Thin web server (v1.5.0 codename Knife)
2013-02-01T20:17:15+00:00 app[web.1]: >> Maximum connections set to 1024
2013-02-01T20:17:15+00:00 app[web.1]: >> Listening on 0.0.0.0:23436, CTRL+C to stop
2013-02-01T20:17:17+00:00 app[web.1]: Completed 200 OK in 232ms (Views: 114.2ms | ActiveRecord: 63.0ms)
2013-02-01T20:17:17+00:00 app[web.1]: Processing by PagesController#index as HTML
2013-02-01T20:17:17+00:00 app[web.1]:   Rendered business_hours/_index.html.slim (24.9ms)
2013-02-01T20:17:17+00:00 app[web.1]:   Rendered pages/index.html.slim within layouts/application (78.4ms)
2013-02-01T20:17:18+00:00 heroku[router]: at=info method=GET path=/assets/foundation/orbit/left-arrow-5a8ccc07cfa3eae4292d7c705fc7b0a2.png host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=5ms connect=18ms service=32ms status=200 bytes=522
2013-02-01T20:17:18+00:00 heroku[router]: at=info method=GET path=/assets/foundation/orbit/right-arrow-6fca0c667c001b2352c44c9fb1e55528.png host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=2ms connect=7ms service=7ms status=200 bytes=3242
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/assets/application-6cd756f9981b294d6c6bd575ae87f94b.css host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=59ms service=15ms status=304 bytes=0
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/assets/orbit_05-c6ea9ca2a7468ee90a6c8bfc87eb607e.jpg host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=0ms service=1ms status=304 bytes=0
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/assets/orbit_03-42632d5ec29efd0b5e4c8cae7336e47c.jpg host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=0ms service=1ms status=304 bytes=0
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/assets/orbit_02-64cae3654d21289ce3fe325715c395ed.jpg host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=2ms service=3ms status=304 bytes=0
2013-02-01T20:31:29+00:00 heroku[router]: at=info method=POST path=/blurbs/1 host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=7ms service=167ms status=500 bytes=643
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/assets/application-ca9f839e91c53f606b8c9344a4a1243e.js host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=0ms connect=0ms service=1ms status=304 bytes=0
2013-02-01T20:31:22+00:00 heroku[router]: at=info method=GET path=/ host=exposehair-staging.herokuapp.com fwd=68.230.151.152 dyno=web.1 queue=0 wait=8ms connect=16ms service=148ms status=200 bytes=30683
我的application.rb文件中还有以下设置:

config.assets.initialize_on_precompile = false
更新:这里是一些相关的要求代码。Heroku上没有呈现js模板,但它们完全在本地工作。这就是我最初省略它的原因

一个例子:

控制器/blurbs.rb

class BlurbsController < ApplicationController
  before_filter :require_login

  # PUT /blurbs/1
  def update
    @blurb = Blurb.find(params[:id])

    respond_to do |format|
      if @blurb.update_attributes(params[:blurb])
        format.js { }
      else
        format.js { render 'reload' }
      end
    end
  end
end

我将日志级别改为debug

# staging.rb
config.log_level = :debug
并注意到:

Started PUT "/blurbs/1" for 68.230.151.152 at 2013-02-11 00:26:26 +0000
2013-02-11T00:26:26+00:00 app[web.1]: Processing by BlurbsController#update as JS
2013-02-11T00:26:26+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"rXyxUFU5qhjR4YieynLVAnr5ADnaUXn+No4Qruw5CFo=", "blurb"=>{"content"=>"# About us\r\n\r\nTell **your story** here."}, "commit"=>"Save", "id"=>"1"}
2013-02-11T00:26:26+00:00 app[web.1]: Completed 500 Internal Server Error in 318ms
2013-02-11T00:26:26+00:00 app[web.1]: 
2013-02-11T00:26:26+00:00 app[web.1]: ActionView::MissingTemplate (Missing template blurbs/update, application/update with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :slim]}. Searched in:
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/app/views"
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/vendor/bundle/ruby/1.9.1/gems/roboto-0.1.0/app/views"
2013-02-11T00:26:26+00:00 app[web.1]: ):
Heroku上的Rails只寻找js、html、erb、builder或slim。不是咖啡剧本。然后我想起了咖啡脚本在我的GEM文件中的资产组中。它可以在heroku上预处理coffeescript,但gem不能与应用程序一起运行。所以我把gem移到了资产组之外,我的应用程序现在可以在Heroku上完美运行了

因为@Dominic的回答让我想到了这一点,如果你想申请我为解决我的问题提供的10美元,请与你的paypal联系。我真的很感激。多谢各位


我将日志级别改为debug

# staging.rb
config.log_level = :debug
并注意到:

Started PUT "/blurbs/1" for 68.230.151.152 at 2013-02-11 00:26:26 +0000
2013-02-11T00:26:26+00:00 app[web.1]: Processing by BlurbsController#update as JS
2013-02-11T00:26:26+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"rXyxUFU5qhjR4YieynLVAnr5ADnaUXn+No4Qruw5CFo=", "blurb"=>{"content"=>"# About us\r\n\r\nTell **your story** here."}, "commit"=>"Save", "id"=>"1"}
2013-02-11T00:26:26+00:00 app[web.1]: Completed 500 Internal Server Error in 318ms
2013-02-11T00:26:26+00:00 app[web.1]: 
2013-02-11T00:26:26+00:00 app[web.1]: ActionView::MissingTemplate (Missing template blurbs/update, application/update with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :slim]}. Searched in:
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/app/views"
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/vendor/bundle/ruby/1.9.1/gems/roboto-0.1.0/app/views"
2013-02-11T00:26:26+00:00 app[web.1]: ):
Heroku上的Rails只寻找js、html、erb、builder或slim。不是咖啡剧本。然后我想起了咖啡脚本在我的GEM文件中的资产组中。它可以在heroku上预处理coffeescript,但gem不能与应用程序一起运行。所以我把gem移到了资产组之外,我的应用程序现在可以在Heroku上完美运行了

因为@Dominic的回答让我想到了这一点,如果你想申请我为解决我的问题提供的10美元,请与你的paypal联系。我真的很感激。多谢各位


一些相关代码如何?(您的控制器操作、Javascript模板、模板路径等)我不认为信息是必要的,因为它在本地工作。。。但我还是要补充一点。谢谢你看这个。我提供10美元通过贝宝支付给第一个人谁可以告诉我如何修复我的应用程序。这里的视频录制:我看到JS模板在您的日志中抛出了一个500:“…method=POST path=/blurbs/1…status=500…”。尝试在生产环境中提高日志级别,看看是否可以从中获得更多有用的数据。此外,您还可以通过使您的开发环境和生产环境尽可能相似来消除错误源。正如Dominic所展示的,这篇文章失败了——它做了大量的数据库工作(以及渲染JS)。例如,我看到您正在使用sqlite进行开发。强烈建议您在本地使用完全相同的数据库-数据库之间存在细微的差异,即使您认为您只是在使用标准SQL。最后,考虑一下使用Rails 3.2.11,原因是。一些相关代码如何?(您的控制器操作、Javascript模板、模板路径等)我不认为信息是必要的,因为它在本地工作。。。但我还是要补充一点。谢谢你看这个。我提供10美元通过贝宝支付给第一个人谁可以告诉我如何修复我的应用程序。这里的视频录制:我看到JS模板在您的日志中抛出了一个500:“…method=POST path=/blurbs/1…status=500…”。尝试在生产环境中提高日志级别,看看是否可以从中获得更多有用的数据。此外,您还可以通过使您的开发环境和生产环境尽可能相似来消除错误源。正如Dominic所展示的,这篇文章失败了——它做了大量的数据库工作(以及渲染JS)。例如,我看到您正在使用sqlite进行开发。强烈建议您在本地使用完全相同的数据库-数据库之间存在细微的差异,即使您认为您只是在使用标准SQL。最后,考虑使用Rails 3.2.11,因为。哈哈,没有必要使用Paypal。很高兴能帮助别人解决问题:)有趣的是,你在问题中把JS模板命名为“views/blurbs/reload.JS”。文件名是否为“views/blurbs/reload.js.coffee”?谢谢。是的,实际上是.js.coffee。我想我在标题里忘了。然而,代码实际上是coffeescript。没有分号!:)哈哈-没有贝宝必要。很高兴能帮助别人解决问题:)有趣的是,你在问题中把JS模板命名为“views/blurbs/reload.JS”。文件名是否为“views/blurbs/reload.js.coffee”?谢谢。是的,实际上是.js.coffee。我想我在标题里忘了。然而,代码实际上是coffeescript。没有分号!:)
Started PUT "/blurbs/1" for 68.230.151.152 at 2013-02-11 00:26:26 +0000
2013-02-11T00:26:26+00:00 app[web.1]: Processing by BlurbsController#update as JS
2013-02-11T00:26:26+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"rXyxUFU5qhjR4YieynLVAnr5ADnaUXn+No4Qruw5CFo=", "blurb"=>{"content"=>"# About us\r\n\r\nTell **your story** here."}, "commit"=>"Save", "id"=>"1"}
2013-02-11T00:26:26+00:00 app[web.1]: Completed 500 Internal Server Error in 318ms
2013-02-11T00:26:26+00:00 app[web.1]: 
2013-02-11T00:26:26+00:00 app[web.1]: ActionView::MissingTemplate (Missing template blurbs/update, application/update with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :slim]}. Searched in:
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/app/views"
2013-02-11T00:26:26+00:00 app[web.1]:   * "/app/vendor/bundle/ruby/1.9.1/gems/roboto-0.1.0/app/views"
2013-02-11T00:26:26+00:00 app[web.1]: ):