Sha256: c5f3233b3bf6107334e7897601da5b80f8bd122db578a9aa034566994f1d6d9f

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

# Expiration

#### Usage

```ruby
# 1. Add column to table
class AddRegulationTimestampColumn < ActiveRecord::Migration
  def change
    t.datetime :expires_at

    # - or -

    add_column :your_model, :expires_at, :datetime
  end
end

# 2. Include module
class User < ActiveRecord::Base
  include Lite::Regulation::Expiration
end
```

#### Methods

```ruby
user = User.first
user.unexpire!
user.unexpired?       #=> true

user.expire!
user.expired?         #=> true

user.extend!
user.extend!(20.days)
user.expired?         #=> false

user.to_expiration    #=> Returns the visibility state locale string (ex: Expired)
```

#### Scopes

```ruby
User.expired    # Returns all expired records
User.unexpired  # Returns all unexpired records
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lite-regulation-1.0.1 docs/EXPIRATION.md
lite-regulation-1.0.0 docs/EXPIRATION.md