Skip to content

Cantango with rails 3

kristianmandrup edited this page Nov 9, 2011 · 4 revisions

CanTango comes with both a Rails 3 Engine and a Railtie. The Railtie currently simply notifies that CanTango is loading. The Rails 3 Engine however, does some more work:

  • Loads all ruby files in app/models
  • Loads all ruby files in app/permits
  • Adds CanTango APIs to views and controllers

See Autoload models and permits on how to enable/disable autoloading.

Autoloading of models is done in order to have models that act as either User or Account models register themselves with CanTango through the class macros: #tango_user and #tango_account respectively. You can also directly register the user and account models (see Configuration) and have your models lazy load normally.

Autoloading of permits is done in order to ensure they are available for the Permit engine.

The Rails 3 engine adds the CanTango APIs to:

  • Rails Views
  • Rails Controllers
  • CanTango::Api module (globally accessible)