Thursday, 15 April 2010

ruby on rails - Heroku Rake Task Does Not Understand Rand Method -



ruby on rails - Heroku Rake Task Does Not Understand Rand Method -

i have rake task created , within have line

number = rand(1..10)

when run on development machine ok, however, when run on heroku i'm returned error

rake aborted! can't convert range integer /app/lib/tasks/sample_data.rake:57:in `rand'

i should note before in rake task ran rand(111) without fail. have assume problem caused me setting start , end point rand take from.

so big questions is, why heroku treat rand range , not integer , how prepare this?

range back upwards in rand() added in ruby 1.9.3. you're running 1.9.2 (the default) on heroku. can run 1.9.3 on heroku adding ruby "1.9.3" gemfile.

http://www.ruby-doc.org/core-1.9.2/kernel.html#method-i-rand http://www.ruby-doc.org/core-1.9.3/kernel.html#method-i-rand

ruby-on-rails ruby ruby-on-rails-3 heroku rake

No comments:

Post a Comment