Sha256: 25332a16da2da01429dbdc9d44feb8c9e71a5abd4f3a23bed2848d7d487afdc6

Contents?: true

Size: 792 Bytes

Versions: 11

Compression:

Stored size: 792 Bytes

Contents

class Flail
  module Rails
    module ControllerMethods
      def flail_request_data
        {
          :parameters => params.to_hash,
          :session_data => flail_session_data,
          :target_url => request.url,
          :referer_url => request.referer,
          :user_agent => request.user_agent,
          :user => flail_user_data
        }
      end

      def flail_session_data
        if session.respond_to?(:to_hash)
          session.to_hash
        else
          session.data
        end
      end

      def flail_user_data
        user = current_user

        user.attributes.select do |k, v|
          /^(id|name|username|email|login)$/ === k unless v.blank?
        end
      rescue NoMethodError, NameError
        {}
      end
    end # ControllerMethods
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
flail-0.1.6 lib/flail/rails/controller_methods.rb
flail-0.1.5 lib/flail/rails/controller_methods.rb
flail-0.1.4 lib/flail/rails/controller_methods.rb
flail-0.1.3 lib/flail/rails/controller_methods.rb
flail-0.1.2 lib/flail/rails/controller_methods.rb
flail-0.1.1 lib/flail/rails/controller_methods.rb
flail-0.1.0 lib/flail/rails/controller_methods.rb
flail-0.0.7 lib/flail/rails/controller_methods.rb
flail-0.0.6 lib/flail/rails/controller_methods.rb
flail-0.0.5 lib/flail/rails/controller_methods.rb
flail-0.0.4 lib/flail/rails/controller_methods.rb