`ClassName.constants` returning empty array in Rails app

后端 未结 1 1185
孤独总比滥情好
孤独总比滥情好 2021-01-16 00:04

I\'m working on a Rails 3 app, and I\'ve got a hierarchy of classes in my lib folder, e.g.:

lib
├── assets
├── tasks
│   └── import.rake
└── imp         


        
相关标签:
1条回答
  • 2021-01-16 01:03

    Using @apneadiving's suggestion, I was able to fix this by adding this line to the beginning of my base.rb file:

    Dir[Rails.root.join('lib/importer/source/**/*.rb')].each(&method(:require))
    
    0 讨论(0)
提交回复
热议问题