Sha256: 89f604acc8d391a3ea3e56e7996827adc653755747322a676d84137cc5874872
Contents?: true
Size: 611 Bytes
Versions: 6
Compression:
Stored size: 611 Bytes
Contents
class StatisticsCollectorController < ActionController::Base def index if klass = params[:type].classify.constantize cookie_name = "seen_#{params[:type].pluralize}".to_sym if object = klass.find_by_id(params[:id]) and (cookies[cookie_name].blank? or !cookies[cookie_name].split(',').include?(object.id.to_s)) object.viewed_counters.new.increment_counter cookies[cookie_name] = { :value => (cookies[cookie_name] || '') + ",#{object.id}", :expires => Date.current.end_of_day } end end render(:nothing => true) end end
Version data entries
6 entries across 6 versions & 1 rubygems