Method: AnnotationSecurity::RelationLoader#define_relation

Defined in:
lib/annotation_security/manager/relation_loader.rb

#define_relation(symbol, *args, &block) ⇒ Object

Defines a new relation for the current resources. However, instead of using

define_relation(:relation_name,args) { |user,res| some_condition }

it is recommended to use

relation_name(args) { |user,res| some_condition }

Parameters

  • symbol name of the relation

  • args additonal arguments, see AnnotationSecurity::Rule for details

  • block (optional) The condition can be passed either as string or as proc



261
262
263
264
265
# File 'lib/annotation_security/manager/relation_loader.rb', line 261

def define_relation(symbol,*args,&block)
  @factories.each do |factory|
    factory.add_rule(symbol,*args,&block)
  end
end