module JamRuby
  class FraudAlert < ActiveRecord::Base

    @@log = Logging.logger[MachineExtra]

    belongs_to :machine_fingerprint, :class_name => "JamRuby::MachineFingerprint"
    belongs_to :user, :class_name => "JamRuby::User"


    def self.create(machine_fingerprint, user)
      fraud = FraudAlert.new
      fraud.machine_fingerprint = machine_fingerprint
      fraud.user = user
      fraud.save

      unless fraud.save
        @@log.error("unable to create fraud: #{fraud.errors.inspect}")
      end
      fraud
    end

    def admin_url
      APP_CONFIG.admin_root_url + "/admin/fraud_alerts/" + id
    end
  end
end