Contact code generation

This commit is contained in:
Andres Keskküla 2014-09-19 12:16:44 +03:00
parent 2d2a12b7d0
commit aecb919610
3 changed files with 10 additions and 3 deletions

View file

@ -78,6 +78,12 @@ class Contact < ActiveRecord::Base
auth_info == pw
end
# generate random id for contact
#
def generate_code
self.code = SecureRandom.hex(4)
end
# Find a way to use self.domains with contact
def domains_owned
Domain.where(owner_contact_id: id)