Jump to content

The ultimate community for Ruby on Rails developers.


Wondering how best to implement signup with email confirmation

signup users

  • Please log in to reply
2 replies to this topic

#1 bizt



  • Members
  • 4 posts

Posted 24 January 2014 - 03:08 AM



I'm new to Rails having just about finished the excellent Rails Tutorial book. I'm about to implement my own version of the user signup/in/out. One thing the book hasn't covered (well, upon finishing the users section - up to chapter 9) is email confirmation. I'm wondering the best means to do this.


I'm sure I can learn easy enough how to send an email but my old process when writing PHP apps was as follows - I'd have the users signup, this would create an entry in the "user_pending" table and an email would be sent to the users inbox. Upon clicking the activation link in the email, the "user_pending" row would be moved to the "user" table (and the old row deleted). I decided upon this method as I didn't want the user table to get bogged down with unactivated users. So if I quickly need to retreive a user from the "user" table while using the app, I can do so quickly by keeping the "user" table light.


What are peoples thoughts on signup pages and email activation? Is this a good method, or should I just put users (activated and unactivated -- but with a "activated" flag column) in the same table and stop giving myself more work to do? Is there a newer better method to activate users?


Thanks for your replies.



#2 stevieing



  • Members
  • 40 posts

Posted 24 January 2014 - 10:12 AM

An activated flag sounds like a more sensible option. You could also use a state machine gem which would allow you more flexibility.


Developing your own authentication system is fine for learning but if you plan to use it in production it is probably better to use an authentication gem such as Devise or AuthLogic which have all of this functionality already built in.


Hope that helps



#3 bizt



  • Members
  • 4 posts

Posted 24 January 2014 - 12:55 PM

Thanks, I'll look into those and for my current app I'll probably just adopt the simple means as it does seems much cleaner than two tables. Great.

Also tagged with one or more of these keywords: signup, users

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users