Sha256: 89167843b2c04e64a3dd38b6d7263cb97c1405c8d2ae35cbaa68c8feb1ea85e1
Contents?: true
Size: 903 Bytes
Versions: 10
Compression:
Stored size: 903 Bytes
Contents
# frozen_string_literal: true module BaseEditingBootstrap module BaseModel extend ActiveSupport::Concern included do include IsValidated include ActionTranslation 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.map(&:to_s) else Pundit.policy(User.new, self.new).permitted_attributes_for_ransack.map(&:to_s) 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
10 entries across 10 versions & 1 rubygems