-
Notifications
You must be signed in to change notification settings - Fork 45
Autoload models and permits
Cantango is by default setup to autoload the following:
- Models (app/models)
- Permits (app/permits)
The autoloading is performed as part of the Cantango Rails engine initialization.
To configure autoloading:
Cantango.configure.autoload do |load|
load.models :off
load.permits :on
end
Models are autoloaded in order to be sure that the Cantango class macros such as #tango_user
are executed
and thus that User and Account models are registered with Cantango.
If you don't wont to autoload the models for performance or other reasons, you can alternatively register the User and Account models directly (see Configuration).
CanTango.config.users.register :admin, AdminUser
Permits autoloading is done to ensure that the Permits are made available to CanTango::Ability. If you want full control over which Permits are loaded when, you can disable this feature and register the Permits manually as described in Configuration.
CanTango.config.permits.register_class AdminUserPermit