1

Please bear with me, I'm not too rails literate.

What I'm trying to do is have 2 sign-ups available. Where there is the default sign-up from devise, and then another sign-up where an admin account can upload a CSV file (with emails and other attributes) that will auto create user accounts based off of those emails. Devise would then auto generate a password, or just send a confirmation link to the email where the user can then finish signing up/confirm their account. I have Admin CRUD working, and I also have the user accounts working fine. I just need to figure out how to have both sign up formats available.

I have checked out this link https://github.com/plataformatec/devise/wiki/How-To:-Override-confirmations-so-users-can-pick-their-own-passwords-as-part-of-confirmation-activation but, being the rails noob that I am, I cannot seem to grasp how to keep both sign-ups.

EDIT

So I have users exportable and importable through a CSV file upload. Here is my import code:

def self.import(file)
  CSV.foreach(file.path, headers: true) do |row|
    user = find_by_id(row["id"]) || new
    user.attributes = row.to_hash.slice(*accessible_attributes)
    user.save!(validate: false)
  end
end

I have it validating to false since it would throw an error stating: "password can't be blank". Should I have a check in this method for blank passwords? But even if I did that I'm not sure of how to make devise send a confirmation email.

Thank you for your time! I really appreciate you looking and taking the time out of your day to help me.

Lisa Zhang
  • 11
  • 4

0 Answers0