SPANISH: Al considerar este artículo de interés común y dado que no he encontrado la explicación en ningún otro sitio, voy a redactarlo en inglés por si puede servir a alguien en un futuro. Si hay algo que no se entienda bien, no dudéis preguntármelo.

I’m working on an online app about auctions. A lot of the users coming to register don’t complete the email confirmation process, although I advise it in a red huge font at the login form. Most of the time I’m getting emils of users saying they registered but can’t login. When I look into the database, they didn’t activate their accounts.

Well, finally our CEO’s decided to remove the activation process. And this is when I’ve been googling for hours without luck, nobody explains the way to do it. Well no problem, it hasn’t been difficult at all. This is the way: a user is active if its activation_code in the database is Null.

  • Edit models/user.rb and remove this filter
    before_create :make_activation_code
  • In the same models/user.rb file, remove the activate method (we’re not activating any more user)
  • In the same models/user.rb file, remove the make_activation_code method (it’s almost at the end of the file).
  • Now edit controllers/users_controller.rb, remove completelly the activate method
  • In the same controller/users_controller.rb file, in the create mehod, set the activated_at time before saving the user
    @user =[:user])
    @user.activated_at =  # <--- add this line
  • Edit models/user_mailer.rb and completelly remove the activation method
  • Remove the file views/user_mailer/activation.html.rb
  • Edit the file views/user_mailer/signup_notification.html.erb and set the message as you like (variables are coming from models/user_mailer.rb)
  • Restart your app and test

I'm sure there are better ways, and I'm not the best coder in the world, but this way works for me. Maybe it will help someone one day...