Class: AuditLog
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- AuditLog
- Defined in:
- lib/sequel/plugins/auditer.rb
Instance Method Summary collapse
- #audit_additional_info ⇒ Object
-
#audit_user ⇒ Object
Obtains the
current_userbased upon the ‘:auditer_current_user_method’ value set in the audited model, either via defaults or via :user_method config options. - #before_validation ⇒ Object
Instance Method Details
#audit_additional_info ⇒ Object
46 47 48 49 50 51 |
# File 'lib/sequel/plugins/auditer.rb', line 46 def audit_additional_info m = Kernel.const_get(associated_type) m.send(m.auditer_additional_info_method) || send(m. auditer_additional_info_method) rescue StandardError nil end |
#audit_user ⇒ Object
Obtains the current_user based upon the ‘:auditer_current_user_method’ value set in the audited model, either via defaults or via :user_method config options
# NOTE! this allows overriding the default value on a per audited model
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sequel/plugins/auditer.rb', line 33 def audit_user user = ::Sequel::Auditer::Railtie.user m = Kernel.const_get(associated_type) u = m.send(m.auditer_current_user_method) || send(m.auditer_current_user_method) return u unless u.nil? return user if u.nil? && !user.nil? nil rescue StandardError nil end |
#before_validation ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sequel/plugins/auditer.rb', line 13 def before_validation # grab the current user if u = audit_user self.modifier = u end # grab any additional info if any if i = audit_additional_info self.additional_info = i end super end |