Sha256: 44b0505fd47978afa2ad15ad9d1b42564e67bae22673ba87dc3af469e6be1fb3

Contents?: true

Size: 432 Bytes

Versions: 3

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

module Talkie
  module Controller
    extend ActiveSupport::Concern

    included do
      delegate :allow?, :comment_form_displayable?, to: :current_permission
      if respond_to? :helper_method
        helper_method :allow?, :comment_form_displayable?
      end
    end

    protected

    def current_permission
      @current_permission ||= Talkie::Permission.new(current_user)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
talkie-0.5.1 lib/talkie/controller.rb
talkie-0.5.0 lib/talkie/controller.rb
talkie-0.4.1 lib/talkie/controller.rb