22 lines
322 B
22 lines
322 B
6 years ago
|
class UserSource < ActiveRecord::Base
|
||
|
belongs_to :user
|
||
|
|
||
|
def generate_email
|
||
|
email = rand_email
|
||
|
while User.exists?(mail: email) do
|
||
|
email = rand_email
|
||
|
end
|
||
|
email
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def rand_email
|
||
|
email_prefix + Random.rand.to_s[2..8] + '@educoder.com'
|
||
|
end
|
||
|
|
||
|
def email_prefix
|
||
|
''
|
||
|
end
|
||
|
end
|