Sha256: 72c885c9214cfd12266acfb3b9d41195f3b4745e069bfa9c7add072587f29352
Contents?: true
Size: 854 Bytes
Versions: 13
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true module BaseEditingBootstrap module BaseModel extend ActiveSupport::Concern included do include IsValidated delegate :ransackable_attributes, :ransackable_associations, to: :@class end class_methods do def ransackable_attributes(auth_object = nil) if auth_object Pundit.policy(auth_object, self.new).permitted_attributes_for_ransack else Pundit.policy(User.new, self.new).permitted_attributes_for_ransack end end def ransackable_associations(auth_object = nil) if auth_object Pundit.policy(auth_object, self.new).permitted_associations_for_ransack.map(&:to_s) else Pundit.policy(User.new, self.new).permitted_associations_for_ransack.map(&:to_s) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems