Class: Odania::StatisticsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Odania::StatisticsController
- Includes:
- Viewable
- Defined in:
- app/controllers/odania/statistics_controller.rb
Instance Method Summary collapse
Instance Method Details
#track_view ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/odania/statistics_controller.rb', line 5 def track_view updated = false class_name = params[:type].nil? ? '' : params[:type].to_s if Odania.trackable_classes.include? class_name obj = class_name.constantize.where(id: params[:id].to_i).first unless obj.nil? updated = update_view_count(obj) end end render :text => updated ? 'updated' : 'duplicate' end |