module Hoodoo::ActiveRecord::Secure

Support mixin for models subclassed from ActiveRecord::Base providing a core out-of-box Hoodoo data access security model. See Hoodoo::ActiveRecord::Secure::ClassMethods#secure for details.

See also:

Constants

ENUMERABLE_INCLUDES_STAR

Convenience constant defining an included-in-enumerable-security-value wildcard security excemption using the String ‘*’.

OBJECT_EQLS_STAR

Convenience constant defining an equals-single-security-value wildcard security exemption using the String ‘*’.

Public Class Methods

included( model ) click to toggle source

Instantiates this module when it is included.

Example:

class SomeModel < ActiveRecord::Base
  include Hoodoo::ActiveRecord::Secure
  # ...
end
model

The ActiveRecord::Base descendant that is including this module.

Calls superclass method
# File lib/hoodoo/active/active_record/secure.rb, line 39
def self.included( model )
  model.class_attribute(
    :nz_co_loyalty_hoodoo_secure_with,
    :instance_predicate => false,
    :instance_accessor  => false
  )

  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
  super( model )
end
instantiate( model ) click to toggle source

When instantiated in an ActiveRecord::Base subclass, all of the Hoodoo::ActiveRecord::Secure::ClassMethods methods are defined as class methods on the including class.

model

The ActiveRecord::Base descendant that is including this module.

# File lib/hoodoo/active/active_record/secure.rb, line 57
def self.instantiate( model )
  model.extend( ClassMethods )
end