From fc9bc1a5be3463afc4b33b5c9fa113f0663168ea Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 09:29:07 -0700 Subject: add script to load database with stub data. --- bin/sample.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/sample.rb diff --git a/bin/sample.rb b/bin/sample.rb new file mode 100755 index 0000000..20ca31b --- /dev/null +++ b/bin/sample.rb @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby +require ::File.expand_path('../../config/environment', __FILE__) + +abc_resources = Company.create(name: 'ABC Resources Ltd.') +xyz_resources = Company.create(name: 'XYZ Resources Ltd.') + +jd = User.create(first_name: 'john', last_name: 'dielwart', company: abc_resources) +hal = User.create(first_name: 'hal', last_name: 'kvisle', company: xyz_resources) + +township_1 = Location.create(latitude: 51.06, longitude: -114.09, township: '1') +township_2 = Location.create(latitude: 40.06, longitude: -100.09, township: '2') + +public_license = jd.apply_for_license(WellType::NFW, township_1) +public_license.update_attribute(:issued_at, 1.day.ago) +public_license.update_attribute(:expired_at, 1.year.from_now) + +public_expired_license = jd.apply_for_license(WellType::DPT, township_1) +public_expired_license.update_attribute(:issued_at, 1.year.ago) +public_expired_license.update_attribute(:expired_at, 1.day.ago) + +confidential_license = hal.apply_for_license(WellType::SPT, township_2) +confidential_license.update_attribute(:issued_at, 1.day.ago) +confidential_license.update_attribute(:expired_at, 1.year.from_now) -- cgit v1.2.3