module EffectiveTrash
bundle exec rails generate effective_trash:trash_archived_booleans
Constants
- VERSION
Public Class Methods
current_user()
click to toggle source
# File lib/effective_trash.rb, line 40 def self.current_user @effective_trash_current_user end
current_user=(user)
click to toggle source
This is set by the “set_effective_trash_current_user” before_filter.
# File lib/effective_trash.rb, line 36 def self.current_user=(user) @effective_trash_current_user = user end
setup() { |self| ... }
click to toggle source
# File lib/effective_trash.rb, line 14 def self.setup yield self end
trash!(obj)
click to toggle source
Trash it - Does not delete the original object. This is run in a before_destroy, or through a script.
# File lib/effective_trash.rb, line 46 def self.trash!(obj) args = (obj.respond_to?(:acts_as_trashable_options) ? obj.acts_as_trashable_options : {}) trash = Effective::Trash.new( trashed: obj, user: EffectiveTrash.current_user, trashed_to_s: obj.to_s, trashed_extra: (trashed_extra if obj.respond_to?(:trashed_extra)), details: Effective::Resource.new(obj).instance_attributes(args) ).save! end