Sha256: 4ec3c4d030d1a460f04576f219534960353b7192a18d08497beff571beab52d4
Contents?: true
Size: 746 Bytes
Versions: 4
Compression:
Stored size: 746 Bytes
Contents
# Expiration #### Usage ```ruby # 1. Add column to table class AddRegulationsTimestampColumn < 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::Regulations::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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lite-regulations-1.1.2 | docs/EXPIRATION.md |
lite-regulations-1.1.1 | docs/EXPIRATION.md |
lite-regulations-1.1.0 | docs/EXPIRATION.md |
lite-regulations-1.0.0 | docs/EXPIRATION.md |