You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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
|