module ActiveRecord::Reflection
Experimental RBS support (using type sampling data from the type_fusion project).
# sig/active_record/reflection.rbs module ActiveRecord::Reflection def reflection_class_for: (Symbol macro) -> Class end
def add_aggregate_reflection(ar, name, reflection)
def add_aggregate_reflection(ar, name, reflection) ar.aggregate_reflections = ar.aggregate_reflections.merge(-name.to_s => reflection) end
def add_reflection(ar, name, reflection)
def add_reflection(ar, name, reflection) ar.clear_reflections_cache name = -name.to_s ar._reflections = ar._reflections.except(name).merge!(name => reflection) end
def create(macro, name, scope, options, ar)
def create(macro, name, scope, options, ar) reflection = reflection_class_for(macro).new(name, scope, options, ar) options[:through] ? ThroughReflection.new(reflection) : reflection end
def reflection_class_for(macro)
Experimental RBS support (using type sampling data from the type_fusion project).
def reflection_class_for: (Symbol macro) -> Class
This signature was generated using 1 sample from 1 application.
def reflection_class_for(macro) case macro when :composed_of AggregateReflection when :has_many HasManyReflection when :has_one HasOneReflection when :belongs_to BelongsToReflection else raise "Unsupported Macro: #{macro}" end end