Ruby (1.9.3) と Rails (3.2.2) を使用しています。データベースに入力される一連の偽のデータを含むタスクファイルがあります。
問題を引き起こしていると思われるタスクの一部を次に示します。
#Create random Tender and populate the db
20.times do |n|
title = "#{Faker::Company.bs()} tender "
company_name = Faker::Company.name
opening_date=Time.at(rand * Time.now.to_i)
closing_date=Time.at(opening_date + ( 8*7*24*60*60)) #add 8 weeks to the deadline
bid_amount= rand(10000..100000)
description=Faker::Lorem.paragraph(sentence_count = 3)
Tender.create!(title: title,
company_name: company_name,
opening_date: opening_date,
closing_date: closing_date,
bid_amount: bid_amount ,
bid_amount: bid_amount ,
description: description )
end
dev では正常に動作しますが、本番データベースでは上記の部分だけが実行されません。私は開発で使用 gem 'sqlite3', '1.3.5'
しています。と
gem 'pg', '0.12.2'
本番環境 (heroku)
私が走るとき
git push heroku
$ heroku pg:reset SHARED_DATABASE --confirm myapp
$ heroku run rake db:migrate
$ heroku run rake db:populate
db:populate throws an error that says **can't covert Range to Integer.**
問題が何であるかについてのアイデアはありますか?
編集: bid_amountのデータ型はdecimal