ページネーションを実装したいと考えています。
Pagyというgemを導入して、db:resetをすると下記のうようなエラーが出てしまいます。
rails aborted! NameError: uninitialized constant Pagy /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant' /api/config/initializers/pagy.rb:1:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:666:in `block in load_config_initializer' /usr/local/bundle/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:182:in `instrument' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:665:in `load_config_initializer' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:625:in `block (2 levels) in <class:Engine>' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `each' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `block in <class:Engine>' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `instance_exec' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `run' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `each' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `tsort_each_child' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:60:in `run_initializers' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:363:in `initialize!' /api/config/environment.rb:5:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /usr/local/bundle/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:339:in `require_environment!' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:523:in `block in run_tasks_blocks' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:20:in `perform' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/command.rb:48:in `invoke' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands.rb:18:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' bin/rails:4:in `<main>' Caused by: NameError: uninitialized constant Pagy /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `load_missing_constant' /api/config/initializers/pagy.rb:1:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:666:in `block in load_config_initializer' /usr/local/bundle/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:182:in `instrument' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:665:in `load_config_initializer' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:625:in `block (2 levels) in <class:Engine>' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `each' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `block in <class:Engine>' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `instance_exec' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `run' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `each' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `tsort_each_child' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/initializable.rb:60:in `run_initializers' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:363:in `initialize!' /api/config/environment.rb:5:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /usr/local/bundle/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:339:in `require_environment!' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/application.rb:523:in `block in run_tasks_blocks' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:20:in `perform' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/command.rb:48:in `invoke' /usr/local/bundle/gems/railties-6.0.3.1/lib/rails/commands.rb:18:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' bin/rails:4:in `<main>' Tasks: TOP => db:reset => db:drop => db:load_config => environment (See full trace by running task with --trace)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。