Sha256: 7b267b05a62454d4e3294300a27bd5912243a6a32a723e86dd826d4501860c7b

Contents?: true

Size: 403 Bytes

Versions: 10

Compression:

Stored size: 403 Bytes

Contents

module Viewable
  protected
  def update_view_count(viewable)     
    stack_name = viewable.class.to_s.underscore.downcase
    already_viewed = (cookies[stack_name] || '').split(',') 

    unless already_viewed.include?(viewable.id.to_s)
      cookies[stack_name] = (already_viewed << viewable.id.to_s).join(',')
      viewable.class.update_counters(viewable.id, {:view_count => 1}) 
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 lib/community_engine/viewable.rb
community_engine-3.0.0 lib/community_engine/viewable.rb
community_engine-2.3.2 lib/community_engine/viewable.rb
community_engine-2.3.1 lib/community_engine/viewable.rb
community_engine-2.3.0 lib/community_engine/viewable.rb
community_engine-2.1.0 lib/community_engine/viewable.rb
community_engine-2.0.0 lib/community_engine/viewable.rb
community_engine-2.0.0.beta3 lib/community_engine/viewable.rb
community_engine-2.0.0.beta2 lib/community_engine/viewable.rb
community_engine-2.0.0.beta1 lib/community_engine/viewable.rb