Module: ActsAsArchived::CanCan

Defined in:
app/models/concerns/acts_as_archived.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_archived(klass) ⇒ Object



52
53
54
55
56
57
# File 'app/models/concerns/acts_as_archived.rb', line 52

def acts_as_archived(klass)
  raise "klass does not implement acts_as_archived" unless klass.respond_to?(:acts_as_archived?)

  can(:archive, klass) { |obj| !obj.archived? }
  can(:unarchive, klass) { |obj| obj.archived? }
end