I am using Rails 4 and ActiveAdmin with SQLite.
1. I created these models and moved the files to folders:
app
models
system
- admin_user.rb
- customer.rb
resources
- document.rb
2. Added to config / application.rb:
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**/}')]
3. In the model files, I simply added a prefix to the model name:
class System::AdminUser < ActiveRecord::Base
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
end
-
So, when I try to run rake db:migrate, I get this error:
LoadError: Unable to autoload constant AdminUser, expected /Users/john/testing/app/models/System/admin_user.rb to define it
Am I doing something wrong?
source
share