diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-21 22:59:41 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-21 22:59:41 -0700 |
| commit | dcb8cddfc3adeb3be6885c00933f1354d3d1e576 (patch) | |
| tree | 08cc870ab382a186f1c34052fed4e66dac20aba8 /app/models | |
| parent | 33cb4e479decb1f7e15048b8c81924fe7498aec1 (diff) | |
rename method and use relation to create new license.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/user.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 446d3e2..056039b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,13 +1,7 @@ class User < ActiveRecord::Base belongs_to :company - def apply_for(well_type, location) - license = License.new - license.company = company - license.well_type = well_type - license.location = location - license.applicant = self - license.save! - license + def apply_for_license(well_type, location) + company.licenses.create(well_type: well_type, location: location, applicant: self) end end |
