Sha256: 18c21dfcf202ff7b362550ef4dc7259358519e0c14fa9d372b9e59c1ffeb5347
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
module Ahoy class VisitsController < ActionController::Base before_filter :halt_bots def create visit = Ahoy.visit_model.new do |v| v.visit_token = params[:visit_token] v.visitor_token = params[:visitor_token] v.ip = request.remote_ip v.user_agent = request.user_agent v.referrer = params[:referrer] v.landing_page = params[:landing_page] v.user = current_user if respond_to?(:current_user) end visit.save! render json: {id: visit.id} end protected def browser @browser ||= Browser.new(ua: request.user_agent) end def halt_bots if browser.bot? render json: {} end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ahoy_matey-0.1.0 | app/controllers/ahoy/visits_controller.rb |