Module: Acl9::Helpers::ClassMethods

Defined in:
lib/acl9/helpers.rb

Instance Method Summary collapse

Instance Method Details

#access_control(method, opts = {}, &block) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
# File 'lib/acl9/helpers.rb', line 8

def access_control(method, opts = {}, &block)
  subject_method = opts.delete(:subject_method) || Acl9::config[:default_subject_method]
  raise ArgumentError, "Block must be supplied to access_control" unless block

  generator = Acl9::Dsl::Generators::HelperMethod.new(subject_method, method)

  generator.acl_block!(&block)
  generator.install_on(self, opts)
end