Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 640 Bytes

VISIBILITY.md

File metadata and controls

38 lines (30 loc) · 640 Bytes

Visibility

Table

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

Usage

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

Methods

user = User.first
user.invisible!
user.invisible?     #=> true
user.visible!
user.visible?       #=> true
user.to_visibility  #=> Returns the visibility state locale string (ex: Visible)

Scopes

User.invisible  # Returns all invisible records
User.visible    # Returns all visible records