Class: Wallaby::ModelClassFilter
- Inherits:
-
Object
- Object
- Wallaby::ModelClassFilter
- Defined in:
- lib/services/wallaby/model_class_filter.rb
Overview
Fitler the model classes using
Class Method Summary collapse
Class Method Details
.execute(all:, allowlisted:, denylisted:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/services/wallaby/model_class_filter.rb', line 10 def execute(all:, allowlisted:, denylisted:) invalid, valid = allowlisted.present? ? [allowlisted - all, allowlisted] : [denylisted - all, all - denylisted] return valid if invalid.blank? raise InvalidError, <<~INSTRUCTION Wallaby can't handle these models: #{invalid.map(&:name).to_sentence}. If it's set via controller_class.models= or controller_class.models_to_exclude=, please remove them from the list. Or they can be added to Custom model list as below, and custom implementation will be required: Wallaby.config do |config| config.custom_models = #{invalid.map(&:name).join ', '} end INSTRUCTION end |