Sha256: 7cce5aba9268d3b2ad1670c060c2a7cb93fb3c9e5d23af751a6f00a373e44cba

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

module AuditRails
  module AuditsHelper
    def add_to_audit(action_name=nil, controller_name=nil, user_name=nil, description=nil)
      if action_name == "login"
        if AuditRails::Audit.no_audit_entry_for_today?(action_name, user_name)
          AuditRails::Audit.create(action: action_name, 
            controller: controller_name || request.params[:controller], 
            user_name: user_name, 
            description: description,
            ip_address: request.remote_ip.to_s)
        end
      else
        AuditRails::Audit.create(action: action_name || request.params[:action],
          controller: controller_name || request.params[:controller],
          user_name: user_name, 
          description: description,
          ip_address: request.remote_ip.to_s)
      end
    end

    def active?(action_name)
      controller.action_name == action_name
    end

    def active_class(action_name)
      active?(action_name) ? 'active' : ''
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
audit_rails-2.0.0 app/helpers/audit_rails/audits_helper.rb