Class: DependentOptionChecker::Checker::DependentChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/dependent_option_checker/checker/dependent_checker.rb

Constant Summary collapse

DEPENDENT_OPTION_VALUES =
i[
  destroy
  destroy_async
  delete_all
  nullify
  restrict_with_exception
  restrict_with_error
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ DependentChecker

Returns a new instance of DependentChecker.



17
18
19
# File 'lib/dependent_option_checker/checker/dependent_checker.rb', line 17

def initialize(model)
  @model = model
end

Instance Method Details

#extract_unspecified_relationsObject



21
22
23
24
25
# File 'lib/dependent_option_checker/checker/dependent_checker.rb', line 21

def extract_unspecified_relations
  reflections.filter_map do |reflection|
    option_specified?(reflection.options) ? nil : reflection.name.to_s
  end
end