Sha256: 9b552f7d059d8cde9b04e65e0cb03f359997d1a00fa62d54bb7ed7afae99674a
Contents?: true
Size: 777 Bytes
Versions: 14
Compression:
Stored size: 777 Bytes
Contents
module Notee class ApplicationRecord < ActiveRecord::Base self.abstract_class = true # scopes scope :trash, -> { where(is_deleted: true) } scope :not_trash, -> { where(is_deleted: false) } scope :time_limit, -> { where('updated_at <= ?', Time.current - 60*60*24*30) } # authority check before_create :create_authority before_update :update_authority, unless: :is_destroy? before_update :destroy_authority, if: :is_destroy? def create_authority Authority.check('create', self) end def update_authority Authority.check('update', self) end def destroy_authority Authority.check('destroy', self) end def is_destroy? return true if self.is_deleted == true false end end end
Version data entries
14 entries across 14 versions & 1 rubygems