diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-21 22:36:24 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-21 22:36:24 -0700 |
| commit | e7902a5ecf47391c50290c06c2df06732a5c6fd0 (patch) | |
| tree | d1f5537104409335450dee659561774e912e8701 /app/models | |
| parent | b50a9b42f1cddc78f75f75913f39bd19fbf4d8d5 (diff) | |
create location model.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/license.rb | 1 | ||||
| -rw-r--r-- | app/models/location.rb | 5 | ||||
| -rw-r--r-- | app/models/user.rb | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/app/models/license.rb b/app/models/license.rb index 3da7b24..ccf9b23 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -1,6 +1,7 @@ class License < ActiveRecord::Base belongs_to :company belongs_to :well_type + has_one :location def self.most_recent(page: 1, per_page: 10) offset = (page - 1) * per_page diff --git a/app/models/location.rb b/app/models/location.rb index 611ae87..bf7b7ef 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -1,4 +1,3 @@ -class Location - def initialize(latitude: 0, longitude: 0, township: 'unknown') - end +class Location < ActiveRecord::Base + belongs_to :license end diff --git a/app/models/user.rb b/app/models/user.rb index 7085ac2..f2197dd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,7 +10,8 @@ class User license.company = company license.well_type = well_type license.location = location - license.applicant = self + #license.applicant = self + license.save! license end end |
