Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 650 Bytes

SUSPENSION.md

File metadata and controls

38 lines (30 loc) · 650 Bytes

Suspension

Table

class AddRegulationsTimestampColumn < ActiveRecord::Migration
  def change
    t.datetime :suspended_at
    add_column :your_model, :suspended_at, :datetime
  end
end

Usage

class User < ActiveRecord::Base
  include Lite::Regulations::Suspension
end

Methods

user = User.first
user.unsuspend!
user.unsuspended?   #=> true
user.suspend!
user.suspended?     #=> true
user.to_suspension  #=> Returns the visibility state locale string (ex: Suspended)

Scopes

User.unsuspended  # Returns all unsuspended records
User.suspended    # Returns all suspended records