Guest User

Untitled

a guest
Feb 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class StatsController < ApplicationController
  2.  
  3. def add
  4. p = params[:path_info] || ""
  5. uri=URI.parse p.gsub(" ", "%20")
  6. if uri.host.nil? or uri.port.nil? or uri.path.nil?
  7. throw "UnparsableURL"
  8. render :text => '//bad_url', :status => 500
  9. return
  10. end
  11. @domain=Domain.find_or_create_by_name(uri.host)
  12. @domain.stats.create(:ip_address => request.remote_ip)
  13.  
  14. render :nothing => true
  15. end
  16. end
Add Comment
Please, Sign In to add comment