Create a new user by a script or console command

22 views
Skip to first unread message

Dennis Mezhevich

unread,
Jan 23, 2017, 6:20:44 AM1/23/17
to diaspora-dev
Hi

Is there a way to add a pod user and set some of its basic properties using a simple script? Maybe some kind of

RAILS_ENV=production bundle exec rails runner ...

? - I'm not experienced enough in Ruby to find it by myself from sources, unfortunately.

I need this to automate rss-bot creation - I'd like to supply my users with some kind of web UI provided an ability to add RSS feeds by user request, adding a new bot user for each feed and start requester to follow the new user automatically.


Thanks,
Dennis


senya

unread,
Jan 23, 2017, 8:32:27 AM1/23/17
to diaspo...@googlegroups.com

Though I'm not sure it is 100% consistent, the following command works for a single user creation:

bundle exec rails runner "User.build(username: \"fillme\", email: \"fil...@email.local\", password: \"password\", password_confirmation: \"password\").save!"

It creates a user with the username "fillme" with the email "fil...@email.local" and the password "password".


23.01.2017 13:14, Dennis Mezhevich пишет:
--
You received this message because you are subscribed to the Google Groups "diaspora-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diaspora-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dennis Mezhevich

unread,
Jan 23, 2017, 10:38:51 AM1/23/17
to diaspora-dev, se...@riseup.net

Thanks a lot! It works and is enough for now.


On Monday, January 23, 2017 at 4:32:27 PM UTC+3, senya wrote:

Though I'm not sure it is 100% consistent, the following command works for a single user creation:

bundle exec rails runner "User.build(username: \"fillme\", email: \"fi...@email.local\", password: \"password\", password_confirmation: \"password\").save!"

It creates a user with the username "fillme" with the email "fi...@email.local" and the password "password".



Reply all
Reply to author
Forward
0 new messages