Class: AuditModel::Models::Base

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/audit_model/models/base.rb

Constant Summary collapse

BLACK_LIST =
[
  "id", 
  "created_at", 
  "updated_at"
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.audit(model, type) ⇒ Object


17
18
19
20
21
22
23
24
25
# File 'lib/audit_model/models/base.rb', line 17

def audit(model, type)
  revision = Revision.new({
    model: model,
    user_id: Thread.current[:user_id],
    revison_date: Time.now
  })
  revision.audit = new sanitizer_args(model, type)
  revision.save!
end

Instance Method Details

#whoObject


12
13
14
# File 'lib/audit_model/models/base.rb', line 12

def who
  revision.user
end