エラー発生前の操作や設定など
参考サイトの通り、設定してコマンドを実行した。
その後、サーバー起動(rails s
)した。
エラー内容
config/routes.rb
Rails.application.routes.draw do devise_for :admin_users, ActiveAdmin::Devise.config devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
devise_for :admin_users, ActiveAdmin::Devise.config
が重複している。。。
参考サイト
本家Active Adminサイト(github)
↑のGetting started(入門)で紹介のあったドキュメント(doc)
原因
config/routes.rb
Rails.application.routes.draw do devise_for :admin_users, ActiveAdmin::Devise.config devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
devise_for :admin_users, ActiveAdmin::Devise.config
が重複していることが、
本エラーの原因だったが、なぜ重複したのかは不明。
参考サイト通り実施したつもりだったが、手順誤りだろうか。。。今となっては、検証できない。
(今後はサイトを参考に学習する際は、こまめにCommitして手順誤りを検証できるようにしようと思う←【教訓🧐】)
参考サイトの手順をやり直したら、下記のやり直し途中のエラー以外、
何も起こらずスムーズに作業が進んだ。
やり直し途中のエラー
再度、手順をやり直している際に、でBundleで管理しているlistenが
Gemfileの指定より新しいと叱られた。下記記事、参照。
The bundle currently has listen locked at [listenのバージョン] - エラーの園
作業環境
$ sw_vers ProductName: Mac OS X ProductVersion: 10.15.4
ruby 2.6.2p47 Rails 6.0.3
解決手順
1.config/routes.rb
の重複した1行を削除(とりあえずコメントアウト)。
Rails.application.routes.draw do devise_for :admin_users, ActiveAdmin::Devise.config # devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
2.サーバー起動
実行時ログ
$ rails s => Booting Puma => Rails 6.0.3 application starting in development => Run `rails server --help` for more startup options Puma starting in single mode... * Version 4.3.3 (ruby 2.6.2-p47), codename: Mysterious Traveller * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://127.0.0.1:3000 * Listening on tcp://[::1]:3000 Use Ctrl-C to stop Started GET "/" for ::1 at 2020-05-11 10:35:45 +0900 (2.5ms) SELECT sqlite_version(*) (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Processing by Rails::WelcomeController#index as HTML Rendering /Users/[user_name]/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.3/lib/rails/templates/rails/welcome/index.html.erb Rendered /Users/[user_name]/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.3/lib/rails/templates/rails/welcome/index.html.erb (Duration: 12.6ms | Allocations: 315) Completed 200 OK in 46ms (Views: 31.2ms | ActiveRecord: 0.0ms | Allocations: 1708)
正常に起動!