Description:
The permit generator creates the authorization and role models, as well as the
migration and an initializer.
You can optionally pass in different names for the authorization, role, and
person class that you want to use. Changing the value for Person will not
alter any existing models, but will be used to generate the proper foreign-key
in the migration.
script/generate permit [Person [Authorization [Role]]]
If you don't want to use named authorizations, and only want to generate the
initializer pass in the --init-only option. You can optionally pass the name
of the class that represents an authenticated user and the generator will set
the name of the current_* method to use to retrieve the subject for
authorization.
script/generate permit [Person] --init-only
Example:
script/generate permit
This will create:
Model: app/models/authorization.rb
Model: app/models/role.rb
Migration: db/migrate/xxx_create_permit_structure.rb
Initializer: config/initializers/permit.rb
script/generate permit Employee Access Job
This will create:
Model: app/models/access.rb
Model: app/models/job.rb
Migration: db/migrate/xxx_create_permit_structure.rb
Initializer: config/initializers/permit.rb
script/generate permit --init-only
This will create:
Initializer: config/initializers/permit.rb