Sha256: a79337f4a6b132db9b994c660bf5aefdd57c964ed17cab86079acb167dfe8c61

Contents?: true

Size: 476 Bytes

Versions: 11

Compression:

Stored size: 476 Bytes

Contents

require "webpacker/helper"

module CmAdmin
  module ApplicationHelper
    include ::Webpacker::Helper

    def current_webpacker_instance
      CmAdmin.webpacker
    end

    # Allow if policy is not defined.
    def has_valid_policy(model_name, action_name)
      return true unless policy([:cm_admin, model_name.classify.constantize]).methods.include?(:"#{action_name}?")
      policy([:cm_admin, model_name.classify.constantize]).send(:"#{action_name}?")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cm-admin-0.7.2 app/helpers/cm_admin/application_helper.rb
cm-admin-0.7.1 app/helpers/cm_admin/application_helper.rb
cm-admin-0.7.0 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.9 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.8 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.7 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.6 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.5 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.4 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.3 app/helpers/cm_admin/application_helper.rb
cm-admin-0.6.2 app/helpers/cm_admin/application_helper.rb