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
45 46 47 48 49 50 51 52 |
# File 'lib/sequel/plugins/auditer.rb', line 45 def audit_additional_info begin m = Kernel.const_get(associated_type) m.send(m.auditer_additional_info_method) || send(m. auditer_additional_info_method) rescue nil end 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 |
# File 'lib/sequel/plugins/auditer.rb', line 33 def audit_user user = ::Sequel::Auditer::Railtie.user return user if !user.nil? begin m = Kernel.const_get(associated_type) m.send(m.auditer_current_user_method) || send(m.auditer_current_user_method) rescue nil end 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 |