From 60aa8fa77deaf9d4c90c1ede37caeeff13ee283d Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 21 Feb 2014 22:27:13 -0700 Subject: define well types table. --- app/models/location.rb | 4 ++++ app/models/user.rb | 16 ++++++++++++++++ app/models/well_type.rb | 10 ++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 app/models/location.rb create mode 100644 app/models/user.rb (limited to 'app') diff --git a/app/models/location.rb b/app/models/location.rb new file mode 100644 index 0000000..611ae87 --- /dev/null +++ b/app/models/location.rb @@ -0,0 +1,4 @@ +class Location + def initialize(latitude: 0, longitude: 0, township: 'unknown') + end +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..7085ac2 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,16 @@ +class User + attr_reader :company + + def initialize(company: nil) + @company = company + end + + def apply_for(well_type, location) + license = License.new + license.company = company + license.well_type = well_type + license.location = location + license.applicant = self + license + end +end diff --git a/app/models/well_type.rb b/app/models/well_type.rb index 5367ce2..361dd99 100644 --- a/app/models/well_type.rb +++ b/app/models/well_type.rb @@ -1,3 +1,9 @@ -class WellType - ALL=[] +class WellType < ActiveRecord::Base + NFW=WellType.find_by_id(1) + NPW=WellType.find_by_id(2) + DPT=WellType.find_by_id(3) + SPT=WellType.find_by_id(4) + DEV=WellType.find_by_id(5) + + ALL=[NFW, NPW, DPT, SPT, DEV] end -- cgit v1.2.3