Module: Activr::Entity::ModelMixin::ClassMethods

Defined in:
lib/activr/entity/model_mixin.rb

Overview

Class methods for the Activr::Entity::ModelMixin mixin

Instance Method Summary collapse

Instance Method Details

#activr_entity(settings) ⇒ Object

TODO:

Add documentation in README for that

Note:

By default, the entity name is inferred from the model class name

Set a custom entity name to use in entity activity feed queries

Parameters:

  • settings (Hash)

    Entity settings

Options Hash (settings):

  • :deletable (Boolean)

    Entity is deletable ? (default: ‘false`)

  • :name (String)

    Custom entity name to use in entity activity feed queries (default is inferred from model class name)

  • :feed_index (Boolean)

    Ensure entity activity feed index ? (default: ‘false`)



81
82
83
# File 'lib/activr/entity/model_mixin.rb', line 81

def activr_entity(settings)
  self.activr_entity_settings = self.activr_entity_settings.merge(settings)
end

#activr_entity_feed_actual_nameSymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get entity name to use for activity feed queries

Returns:

  • (Symbol)


63
64
65
# File 'lib/activr/entity/model_mixin.rb', line 63

def activr_entity_feed_actual_name
  self.activr_entity_settings[:name] || Activr::Utils.kind_for_class(self).to_sym
end