Class: Notches::HitsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/notches/hits_controller.rb

Instance Method Summary collapse

Instance Method Details

#newObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/notches/hits_controller.rb', line 2

def new
  session[:notched] = true

  Notches::Hit.log(
    :url        => params[:url],
    :user_agent => request.env["HTTP_USER_AGENT"],
    :user_id    => params[:user_id],
    :session_id => request.session_options[:id],
    :ip         => request.remote_ip
  )

  # Don't cache the image.
  response.header["Last-Modified"] = Time.now.httpdate

  send_file Notches::Engine.root.join("app/assets/images/notches/hit.gif"),
            :type => "image/gif",
            :disposition => "inline"
end