19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ActiveAdmin で初期ユーザーを作成する方法

Last updated at Posted at 2015-10-21

方法1

ActiveAdmin が seed ファイルを用意してくれているので

$ rake db:seed すれば良い。

この場合はおそらく、次のデータが作成される。

email: admin@example.com
password: password

( 詳しくは db/seeds.rb を見てみよう )

方法2

pry ( Rails のコンソール ) で直接作っても良い。

プロジェクトに移動する。

cd /path/to/project

Rails のコンソールを立ち上げる。

$ bundle exec rails console

ActiveAdmin のユーザー作成メソッドを実行する。

pry(main)> AdminUser.create!(:email => 'admin@example.com', :password => 'password')

入力したパスワードは暗号化され、ユーザーが作成される。

バージョン

  • ActiveAdmin 4.2.4

補足

ActiveAdminでRails管理画面を作成 を参考にした。

上記のページでは password_confirmation ( パスワードの確認 ) というパラメータを渡しているが、自分の環境では必要なかった。
email と password を指定するだけで動いた。

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

メンター受付

19
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?