Sha256: 1d2712490241786bb03ec740aa97bfa50bb204fa9888c706c4516e6624f76f9d
Contents?: true
Size: 727 Bytes
Versions: 4
Compression:
Stored size: 727 Bytes
Contents
# frozen_string_literal: true require "invisible_record/helper" module InvisibleRecord # Add invisible behavior to an ActiveRecord Model module Model def acts_as_invisible(**options) options.deep_symbolize_keys! deleted_timestamp_attr = options[:deleted_timestamp_attribute] || "deleted_at" raise "Only call acts_as_invisible once per model" if respond_to?(:invisible_record_model?) class_eval do class << self def invisible_record_model? true end end Helper.define_hidden_attributes self, deleted_ts_attr: deleted_timestamp_attr Helper.define_actions self, deleted_ts_attr: deleted_timestamp_attr end end end end
Version data entries
4 entries across 4 versions & 1 rubygems