Ruby on rails 出了点问题。Heroku应用程序问题

Ruby on rails 出了点问题。Heroku应用程序问题,ruby-on-rails,heroku,hosting,Ruby On Rails,Heroku,Hosting,所以Heroku已经停机一整天了,当然,直到我对我的应用程序做了大量的修改之后,我才意识到这一点。现在Heroku恢复了,我的应用程序坏了 这是一个随机文本块,使stackoverflow认为我已经更好地解释了我的代码块,因为他们不会让我发布其他内容 这是我的heroku日志: 2012-06-30T22:58:31+00:00 app[web.1]: app/helpers/application_helper.rb:23:in `landing_photo' 2012-06-30T22:

所以Heroku已经停机一整天了,当然,直到我对我的应用程序做了大量的修改之后,我才意识到这一点。现在Heroku恢复了,我的应用程序坏了

这是一个随机文本块,使stackoverflow认为我已经更好地解释了我的代码块,因为他们不会让我发布其他内容

这是我的heroku日志:

2012-06-30T22:58:31+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `landing_photo'
2012-06-30T22:58:31+00:00 app[web.1]:   app/views/pages/home.html.erb:3:in `_app_views_pages_home_html_erb__3529485503375966156_14193960'
2012-06-30T22:58:31+00:00 app[web.1]: 
2012-06-30T22:58:31+00:00 app[web.1]: 
2012-06-30T22:58:31+00:00 heroku[router]: GET jasonmccarthy.ie/ dyno=web.1 queue=0 wait=0ms service=195ms status=500 bytes=643
2012-06-30T22:58:31+00:00 heroku[nginx]: 194.46.182.60 - - [30/Jun/2012:22:58:31 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11" jasonmccarthy.ie
2012-06-30T22:58:48+00:00 heroku[run.1]: Awaiting client
2012-06-30T22:58:48+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:migrate`
2012-06-30T22:58:48+00:00 heroku[run.1]: State changed from starting to up
2012-06-30T22:58:54+00:00 heroku[run.1]: Process exited with status 0
2012-06-30T22:58:54+00:00 heroku[run.1]: State changed from up to complete
2012-06-30T22:58:57+00:00 app[web.1]: 
2012-06-30T22:58:57+00:00 app[web.1]: 
2012-06-30T22:58:57+00:00 app[web.1]: Started GET "/" for 194.46.182.60 at 2012-06-30 22:58:57 +0000
2012-06-30T22:58:57+00:00 app[web.1]: Processing by PagesController#home as HTML
2012-06-30T22:58:57+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (0.7ms)
2012-06-30T22:58:57+00:00 app[web.1]: Completed 500 Internal Server Error in 1ms
2012-06-30T22:58:57+00:00 heroku[router]: GET jasonmccarthy.ie/ dyno=web.1 queue=0 wait=0ms service=15ms status=500 bytes=643
2012-06-30T22:58:57+00:00 app[web.1]: 
2012-06-30T22:58:57+00:00 app[web.1]: ActionView::Template::Error (can't convert Range into Integer):
2012-06-30T22:58:57+00:00 app[web.1]:     1: <% provide(:title, 'Jason Mc Carthy | Fashion Photography Wedding Photography') %>
2012-06-30T22:58:57+00:00 app[web.1]:     2: 
2012-06-30T22:58:57+00:00 app[web.1]:     3: <%= landing_photo %>
2012-06-30T22:58:57+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `landing_photo'
2012-06-30T22:58:57+00:00 app[web.1]:     4: 
2012-06-30T22:58:57+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `rand'
2012-06-30T22:58:57+00:00 app[web.1]:     5: <span id="tagline">Endeavouring to build a creative &amp; inspiring 2D world</span>
2012-06-30T22:58:57+00:00 app[web.1]:   app/views/pages/home.html.erb:3:in `_app_views_pages_home_html_erb__3529485503375966156_14193960'
2012-06-30T22:58:57+00:00 app[web.1]: 
2012-06-30T22:58:57+00:00 app[web.1]: 
2012-06-30T22:58:57+00:00 heroku[nginx]: 194.46.182.60 - - [30/Jun/2012:22:58:57 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11" jasonmccarthy.ie
2012-06-30T23:04:47+00:00 heroku[slugc]: Slug compilation started
2012-06-30T23:05:24+00:00 heroku[api]: Release v30 created by colmtuite@gmail.com
2012-06-30T23:05:24+00:00 heroku[api]: Deploy b7f77bc by colmtuite@gmail.com
2012-06-30T23:05:24+00:00 heroku[web.1]: State changed from up to starting
2012-06-30T23:05:25+00:00 heroku[slugc]: Slug compilation finished
2012-06-30T23:05:26+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 18620`
2012-06-30T23:05:27+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-06-30T23:05:28+00:00 app[web.1]: [2012-06-30 23:05:28] ERROR SignalException: SIGTERM
2012-06-30T23:05:28+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2012-06-30T23:05:29+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:5)
2012-06-30T23:05:29+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:5)
2012-06-30T23:05:34+00:00 app[web.1]: [2012-06-30 23:05:34] INFO  WEBrick 1.3.1
2012-06-30T23:05:34+00:00 app[web.1]: [2012-06-30 23:05:34] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-06-30T23:05:34+00:00 app[web.1]: [2012-06-30 23:05:34] INFO  WEBrick::HTTPServer#start: pid=1 port=18620
2012-06-30T23:05:35+00:00 heroku[web.1]: State changed from starting to up
2012-06-30T23:05:36+00:00 app[web.1]: => Booting WEBrick
2012-06-30T23:05:36+00:00 app[web.1]: => Rails 3.2.3 application starting in production on http://0.0.0.0:18620
2012-06-30T23:05:36+00:00 app[web.1]: => Call with -d to detach
2012-06-30T23:05:36+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-06-30T23:05:36+00:00 app[web.1]: 
2012-06-30T23:05:36+00:00 app[web.1]: 
2012-06-30T23:05:36+00:00 app[web.1]: Started GET "/" for 194.46.182.60 at 2012-06-30 23:05:36 +0000
2012-06-30T23:05:36+00:00 app[web.1]: Processing by PagesController#home as HTML
2012-06-30T23:05:36+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (79.1ms)
2012-06-30T23:05:36+00:00 app[web.1]: Completed 500 Internal Server Error in 108ms
2012-06-30T23:05:36+00:00 app[web.1]: ActionView::Template::Error (can't convert Range into Integer):
2012-06-30T23:05:36+00:00 app[web.1]: 
2012-06-30T23:05:36+00:00 app[web.1]:     1: <% provide(:title, 'Jason Mc Carthy | Fashion Photography Wedding Photography') %>
2012-06-30T23:05:36+00:00 app[web.1]:     2: 
2012-06-30T23:05:36+00:00 app[web.1]:     3: <%= l
anding_photo %>
2012-06-30T23:05:36+00:00 app[web.1]:     4: 
2012-06-30T23:05:36+00:00 app[web.1]:     5: <span id="tagline">Endeavouring to build a creative &amp; inspiring 2D world</span>
2012-06-30T23:05:36+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `rand'
2012-06-30T23:05:36+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `landing_photo'
2012-06-30T23:05:36+00:00 app[web.1]:   app/views/pages/home.html.erb:3:in `_app_views_pages_home_html_erb__3704543374435589796_23990640'
2012-06-30T23:05:36+00:00 app[web.1]: 
2012-06-30T23:05:36+00:00 app[web.1]: 
2012-06-30T23:05:36+00:00 heroku[router]: GET jasonmccarthy.ie/ dyno=web.1 queue=0 wait=0ms service=238ms status=500 bytes=643
2012-06-30T23:05:36+00:00 heroku[nginx]: 194.46.182.60 - - [30/Jun/2012:23:05:36 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11" jasonmccarthy.ie
2012-06-30T23:05:37+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2012-06-30T23:05:37+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2012-06-30T23:05:38+00:00 heroku[web.1]: Process exited with status 137
2012-06-30T23:05:49+00:00 heroku[web.1]: State changed from up to starting
2012-06-30T23:05:51+00:00 app[web.1]: 
2012-06-30T23:05:51+00:00 app[web.1]: 
2012-06-30T23:05:51+00:00 app[web.1]: Started GET "/" for 194.46.182.60 at 2012-06-30 23:05:51 +0000
2012-06-30T23:05:51+00:00 app[web.1]: Processing by PagesController#home as HTML
2012-06-30T23:05:51+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (0.6ms)
2012-06-30T23:05:51+00:00 app[web.1]: Completed 500 Internal Server Error in 1ms
2012-06-30T23:05:51+00:00 app[web.1]: 
2012-06-30T23:05:51+00:00 app[web.1]: ActionView::Template::Error (can't convert Range into Integer):
2012-06-30T23:05:51+00:00 app[web.1]:     2: 
2012-06-30T23:05:51+00:00 app[web.1]:     1: <% provide(:title, 'Jason Mc Carthy | Fashion Photography Wedding Photography') %>
2012-06-30T23:05:51+00:00 app[web.1]:     3: <%= landing_photo %>
2012-06-30T23:05:51+00:00 app[web.1]:     4: 
2012-06-30T23:05:51+00:00 app[web.1]:     5: <span id="tagline">Endeavouring to build a creative &amp; inspiring 2D world</span>
2012-06-30T23:05:51+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `rand'
2012-06-30T23:05:51+00:00 app[web.1]:   app/helpers/application_helper.rb:23:in `landing_photo'
2012-06-30T23:05:51+00:00 app[web.1]:   app/views/pages/home.html.erb:3:in `_app_views_pages_home_html_erb__3704543374435589796_23990640'
2012-06-30T23:05:51+00:00 app[web.1]: 
2012-06-30T23:05:51+00:00 app[web.1]: 
2012-06-30T23:05:51+00:00 heroku[nginx]: 194.46.182.60 - - [30/Jun/2012:23:05:51 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11" jasonmccarthy.ie
2012-06-30T23:05:51+00:00 heroku[router]: GET jasonmccarthy.ie/ dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=643
2012-06-30T23:05:52+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 23782`
2012-06-30T23:05:52+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-06-30T23:05:53+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2012-06-30T23:05:53+00:00 app[web.1]: [2012-06-30 23:05:53] ERROR SignalException: SIGTERM
2012-06-30T23:05:57+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:5)
2012-06-30T23:05:57+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:5)
网页/主页:

<%= landing_photo %>

假设您没有向Heroku推送任何引入错误代码的新代码


我会检查你是否能在本地重现错误。如果一切都是可靠的,我会再次尝试将您的最新代码重新部署到heroku。

您对rand方法使用了错误的参数,它只接受一个整数,而不接受它们的范围

你在找什么

random = Random.rand(4)
您的另一个选项不是使用Random,而是使用


这可能是Ruby版本的问题,因为在我运行MRI-1.9.3的系统上,
random=random.rand(1..4)
可以正常工作。也许是电风暴让Heroku改变了你的红宝石。也许你在1.9.3中依赖的是现在已经不存在的实验室插件

使用heroku run ruby-v检查您正在运行的版本,您可以通过将以下内容放在文件顶部来强制他们使用1.9.3:

source 'https://rubygems.org'
ruby '1.9.3'

该错误似乎是
landing\u photo
方法中的某种转换错误,从日志中我可以看出,它似乎与某种类型的随机数发生器有关。试试看你是否可以在本地复制它,或者在这里放一些代码(例如,
landing\u photo
方法)。@Frost Ok我添加了随机化程序代码。奇怪的是,这可能会导致一个问题,据我所知,这段代码在Heroku倒下之前就没有被触动过。本地一切都很好。我在停机期间推动了一些更改,更新了rails版本等。我尝试恢复到更改任何内容之前的代码方式。我推了我的最新代码,仍然不起作用..兰德确实接受MRI-1.9.3中的一个范围,所以如果这个代码起作用,那么应用程序运行的Ruby版本可能已经发生了某种变化。我想你已经了解了一些情况。但是,当我将那个ruby版本添加到我的GEM文件时,我无法运行bundle。它返回了一个错误。啊,我认为您可能需要将bundler版本升级到-just run
gem install bundler-v1.2.0.pre--pre
random = (1..4).to_a.sample
source 'https://rubygems.org'
ruby '1.9.3'