Hi,
I need to craeet the anonymous/guest user at some satuations and it was required to have email as the mandatory column in the DB. I have used the below process for creating the email on fly to make it more unique.
def create_anonymous_user
u = User.new(email: "guest_#{Time.now.to_i}#{rand(99)}
@example.com")
u.confirmed_at = Time.now
u.save(:validate => false, :confirm => false)
u
end
I hope this make the user record creation by eliminating all required validations and making the email unique.
Thank You,
Uma Mahesh.
I need to craeet the anonymous/guest user at some satuations and it was required to have email as the mandatory column in the DB. I have used the below process for creating the email on fly to make it more unique.
def create_anonymous_user
u = User.new(email: "guest_#{Time.now.to_i}#{rand(99)}
@example.com")
u.confirmed_at = Time.now
u.save(:validate => false, :confirm => false)
u
end
I hope this make the user record creation by eliminating all required validations and making the email unique.
Thank You,
Uma Mahesh.
No comments:
Post a Comment