Support mixin for models subclassed from ActiveRecord::Base providing context-aware model instance creation, allowing service authors to auto-inherit related features from Hoodoo without changing their code.

It is STRONGLY RECOMMENDED that you use the likes of:

  • Hoodoo::ActiveRecord::Creator::ClassMethods::new_in

…to create model instances and participate “for free” in whatever plug-in ActiveRecord modules are mixed into the model classes, such as Hoodoo::ActiveRecord::Dated and Hoodoo::ActiveRecord::ManuallyDated.

See also:

Namespace
Methods
I
Class Public methods
included( model )

Instantiates this module when it is included.

Example:

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

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

# File lib/hoodoo/active/active_record/creator.rb, line 53
def self.included( model )
  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
  super( model )
end
instantiate( model )

When instantiated in an ActiveRecord::Base subclass, all of the Hoodoo::ActiveRecord::Dated::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/creator.rb, line 65
def self.instantiate( model )
  model.extend( ClassMethods )
end