0

So I have made some dummy data (mostly new users) for an app I'm working on for my capstone. I decided that sending out email conformations to a user so they can click on a link to verify their account was a pretty cool feature to add to my app. So with the help of devise and a little trolling on the internet, I was able to add the feature successfully.

Here is where I'm stuck, My dummy data consists of dummy emails, which are getting sent a confirmation email, which they obviously have to click to activate the account, so that their confirmed_at status on my postgres database changes to the time they clicked the confirmation email(which will never happen).

So it seems there is a confirmation_token that goes along with the email, and I tried a few things, obviously unsuccessful, hence the reason for the question.

  1. I tried to loop through all users in rails c and assign each user.confirmed_at = Time.now, after running this, and then put user.confirmed_at gives me the the current time on all of the confirmed_at attribute for each user but does not update on postgres and in turn I get the flash message of you must confirm your email before you can sign in , when trying to sign in.

  2. I tried to just paste info on the postgres database itself under the confirmed_at column but that does not work, cause it won't show on the rails c, or allow me to sign in.

Any tips on bypassing the confirmed_at just(other than to set up new users through console manually and skipping the confirmation part, as I already have users created and would like to use those) would be greatly appreciated. Looking forward to your response.

kparekh01
  • 221
  • 1
  • 7
  • Have you tried using `.confirm!` on the `User` object ? – Abhinay Aug 27 '16 at 05:31
  • See this example here: http://stackoverflow.com/a/17006426/2545197 – Abhinay Aug 27 '16 at 05:31
  • Yes @Abhinay, when i tried confirm! on User object I get the following: undefined method `confirm!' for # , I will however look into the link you showed. Thanks. – kparekh01 Aug 27 '16 at 13:09
  • Also regarding the link you sent, I saw that already and it explains how to set up new users via skipping confirmation, not changing existing ones that were created in which an email was sent out. Will dig in to it a little more, but might have to install a faker gem and set up all new dummy data. – kparekh01 Aug 27 '16 at 13:13
  • That's where .confirm comes into the picture. You can run this method on older user records to confirm. Please check if your confirmable module is working properly. Cause if it's enabled then application should not throw undefined method. – Abhinay Aug 27 '16 at 13:16
  • Just did it with .confirm, as previously I was trying it with .confirm! and I'm on rails 5, don't know why the bang would throw an error, but now my postgres db has updated confirmed_at for all accounts. Any indea on why the bang would throw an error? – kparekh01 Aug 27 '16 at 13:22

0 Answers0