HTTPS clone URL
Subversion checkout URL
Clone this wiki locally
Permits can be configured to be executed in one or more execution modes. The built in modes are:
#modes macro is used to indicate which modes the Permit is executed for. By default, a Permit will be executed for all execution modes.
The following Editor Role Permit will only be executed for the
module Permit::Admin::Role class Editor < CanTango::Permit::Role def calc_rules can :edit, Post if session[:edit_mode] end modes :no_cache end end
The following code sets up a Permit with a specific namespace (scope)
class AdminAccount < ActiveRecord::Base class EditorRolePermit < CanTango::Permit::Role tango_permit :name => :editor, :type => :role, :ns => :admin def calc_rules can :edit, Post if session[:edit_mode] end modes :no_cache end end
tango_permit macro is used to explicitly configure the Permit with the CanTango Permits system (registry).