Sha256: 688a6fef7de8942e7cd11d2876028103aa35b4f5843d5cfb4086b7882f243432

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

require 'commontator/shared_helper'
require 'commontator/security_transgression'

module Commontator
  module ControllerIncludes
    def self.included(base)
      base.helper Commontator::SharedHelper
    end
    
    def commontator_thread_show(commontable)
      user = send Commontator.current_user_method	
      raise SecurityTransgression unless (user.nil? || user.is_commontator)
      
      thread = commontable.thread
      raise SecurityTransgression unless thread.can_be_read_by?(user)
      thread.mark_as_read_for(user)
      @commontator_thread_show = true
    end
  end
end

ActionController::Base.send :include, Commontator::ControllerIncludes

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commontator-2.0.2 lib/commontator/controller_includes.rb~
commontator-4.0.1 lib/commontator/controller_includes.rb~
commontator-4.0.0 lib/commontator/controller_includes.rb~