Was ist der Rails-Befehl, um einen Admin-Benutzer in Discourse zu erstellen?

Wie in diesem Beitrag beschrieben, erhalte ich beim Ausführen dieses Befehls, um einen Admin-Benutzer auf einer neuen Discourse-Installation über die Rails-Konsole zu erstellen (ohne dass eine Aktivierung per E-Mail erforderlich ist, und zwar nur einmal für einen Admin):

u = User.create!(username: ‘xx’, email: ‘xx@xx.com’, password: ‘xxx’, mailing_list_mode: ‘true’); u.approve(Discourse.system_user, false); u.activate

folgenden Fehler:

[1] pry(main)> ="u = User.create!(username: 'user1', email: 'user1@email.com', password: 'Password12345', mailing_list_mode: 'true'); u.approve(Discourse.system_user, false); u.activate"

SyntaxError: unexpected '=', expecting end-of-input
="u = User.create!(username: ...
^

Ich bin kein Nutzer von Rails-Befehlen. Ich wäre Ihnen dankbar, wenn Sie mir den exakten Befehl mit den korrekten Anführungszeichen usw. nennen könnten, den ich verwenden muss, um auf einer frischen Discourse-Installation einfach nur einen Admin-Benutzer zu erstellen.

Take your pick:

rake admin:create                                                      # Creates a forum administrator
rake admin:invite[email]                                               # invite an admin to this discourse instance

FYI, when you are not sure, you can always:

rake --tasks

To get a list of rakes.

3 „Gefällt mir“

Thanks.
But email sending is not working, that’s why I said I want to use it only once, just to create one admin user.

rake admin:create that’ll help you create admin

3 „Gefällt mir“

But in this command, we’ve not specified any username or password.
how will we login thereafter?

Sorry, as I said, I don’t know a thing about rails commands. Just want to this one ‘needed’ command.

[6] pry(main)> rake admin:create                                                      # Creates a forum administrator
NameError: undefined local variable or method `create' for main:Object
from (pry):5:in `__pry__'

That is why I posted two choices.

You can pick based on your situation now and in the future.

Run the command and it will ask you.

[6] pry(main)> rake admin:create                                                      # Creates a forum administrator
NameError: undefined local variable or method `create' for main:Object
from (pry):5:in `__pry__'

It isn’t entered in the rails console.

Use:

./launcher enter app
rake admin:create
4 „Gefällt mir“

Oh! my my!!

Thanks.

Did it, and all ok now.

3 „Gefällt mir“

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.