Skip to content
kristianmandrup edited this page Aug 19, 2011 · 2 revisions

CanTango comes with the Rails 3 generators to do the following:

  • install (initializer and yaml files)
  • create user permit
  • create account permit
  • create role permit(s)
  • create role group permit(s)
  • create license(s)
  • create permit(s) scoped under a specific account

Installation generator

Installs CanTango in your app by generating the following files

  • cantango.rb initializer
  • categories.yml (optional)
  • permissions.yml (optional)

rails g cantango:install

User permit generator

Generate a single permit for a given user model

rails g cantango:user_permit Guest --read all

Account permit generator

Generate a single permit for a user account model

rails g cantango:account_permit Admin --manage all

Role permit generator

Generate a single permit for a role or role group

rails g cantango:role_permit Editor --manage article post --edit comment

For a role group:

rails g cantango:role_permit Editor --manage article post --edit comment --group

To scope permit for a specific account:

rails g cantango:role_permit Publisher --edit article post --account admin

Role permits generator

Generate permits for a list of roles or role groups

rails g cantango:role_permits editor publisher

For role groups:

rails g cantango:role_permits editor publisher --group

License generator

Generate a single license (see Licenses)

rails g cantango:license article_writing --edit article post --create article

Licenses generator

Generate multiple licenses

rails g cantango:licenses article_writing blogging

General usage notes

You can always get a list of all available options simply by running the generator with the --help option:

rails g cantango:licenses --help

Enjoy!