Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StatsController < ApplicationController
- def add
- p = params[:path_info] || ""
- uri=URI.parse p.gsub(" ", "%20")
- if uri.host.nil? or uri.port.nil? or uri.path.nil?
- throw "UnparsableURL"
- render :text => '//bad_url', :status => 500
- return
- end
- @domain=Domain.find_or_create_by_name(uri.host)
- @domain.stats.create(:ip_address => request.remote_ip)
- render :nothing => true
- end
- end
Add Comment
Please, Sign In to add comment