Sha256: 6aa93e1e3c36533b9914c0a2dadd325b044b71d5153353a4a4ee662780361e90
Contents?: true
Size: 697 Bytes
Versions: 1
Compression:
Stored size: 697 Bytes
Contents
$:.push File.expand_path('../', __FILE__) require "active_support/all" require "archiveable/version" module Archiveable extend ActiveSupport::Concern included do scope :published, -> { where archived_at: nil } scope :archived, -> { where.not archived_at: nil } end def published !archived end def published=(value) self.archived = !value end def archived archived_at.present? end def archived=(value) self.archived_at = value ? Time.now : nil end def archive update archived: true end def archive! update! archived: true end def publish update archived: false end def publish! update! archived: false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archiveable-0.0.5 | lib/archiveable.rb |