---
name: "Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata"
section: "3pm"
platform: "linux"
package: "libjifty-perl"
version: "1.10518+dfsg-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata"
---

# Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata(3pm)

ActorMetadata mixin

## NAME

Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata - ActorMetadata mixin

## SYNOPSIS

```
  package MyApp::Model::CoffeeShop;
  use Jifty::DBI::Schema;
  use MyApp::Record schema {
      # custom column definitions
  };
  use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on and updated_by
```

## DESCRIPTION

## SCHEMA

This mixin adds the following columns to the model schema:

### created\_by

### created\_on

### updated\_on

### updated\_by

## METHODS

\# XXX: pod coverage should count parent classes.  this pod is useless

### register\_triggers

Adds the triggers to the model this mixin is added to.

### register\_triggers\_for\_column

### before\_create

Sets `"created_by"`, `"created_on"`, `"updated_on"` and `"updated_by"` based on the current user and time.

### after\_set

update `"updated_on"` and `"updated_by"` based on the current user and current time.

### current\_user\_can

Rejects creation unless there's a current\_user.

### current\_user\_is\_owner

### import

to be more flexible, we allow some configurations like: e.g. use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata \
     user\_class =\> 'Foo::Model::Principal',\
     map =\> { created\_by =\> 'creator', created\_on =\> 'created' }

current valid args are: user\_class =\> 'Foo::Model::User'  \
         class that you want created\_by and updated\_by to be refers\_to map =\> { created\_by =\> 'creator', ... }\
         the real column name you want to use. this also controls whether\
         a column will be added or not. i.e. if the hashref is \
         { created\_by =\> 'creator', created\_on =\> 'created' }, then columns\
         'updated\_by' and 'updated\_on' will not be added.
