Module: Boba::ActiveRecord::ReflectionService

Extended by:
T::Sig
Defined in:
lib/boba/active_record/reflection_service.rb

Constant Summary collapse

ReflectionType =
T.type_alias do
  T.any(::ActiveRecord::Reflection::ThroughReflection, ::ActiveRecord::Reflection::AssociationReflection)
end

Class Method Summary collapse

Class Method Details

.required_reflection?(reflection) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/boba/active_record/reflection_service.rb', line 17

def required_reflection?(reflection)
  return true if has_one_and_required_reflection?(reflection)

  belongs_to_and_non_optional_reflection?(reflection)
end