コマンド
rails console で以下を実行
ActiveSupport::Dependencies.autoload_paths
実行例
irb(main):001:0> ActiveSupport::Dependencies.autoload_paths
=>
["/Users/yumainaura/example/app/channels",
"/Users/yumainaura/example/app/controllers",
"/Users/yumainaura/example/app/controllers/concerns",
"/Users/yumainaura/example/app/helpers",
"/Users/yumainaura/example/app/jobs",
"/Users/yumainaura/example/app/mailers",
"/Users/yumainaura/example/app/models",
"/Users/yumainaura/example/app/models/concerns",
"/Users/yumainaura/example/app/uploaders",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionmailbox-7.0.2.4/app/controllers",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionmailbox-7.0.2.4/app/jobs",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionmailbox-7.0.2.4/app/models",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activestorage-7.0.2.4/app/controllers",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activestorage-7.0.2.4/app/controllers/concerns",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activestorage-7.0.2.4/app/jobs",
"/Users/yumainaura/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activestorage-7.0.2.4/app/models",
"/Users/yumainaura/example/test/mailers/previews"]
autoloadの追加設定
config/application.rb
などで設定する
require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
module Example
class Application < Rails::Application
config.load_defaults 7.0
config.autoload_paths << "#{root}/app/uploaders"
end
end
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。