diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-22 09:29:07 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-22 09:29:07 -0700 |
| commit | fc9bc1a5be3463afc4b33b5c9fa113f0663168ea (patch) | |
| tree | 51354402285ec1bb26959a7d28c3cc831c918aa2 | |
| parent | bf25475d2434452097abb14ab6f2df2c8a4ea856 (diff) | |
add script to load database with stub data.
| -rwxr-xr-x | bin/sample.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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) |
