lib/extensions/ar_virtual.rb
# invalid associations return a nil
# real reflections are followed
# a virtual association will stop the traversal
# @returns [nil, Array<Relation>]
invalid associations return a nil
real reflections are followed
a virtual association will stop the traversal
invalid associations return a nil real reflections are followed a virtual association will stop the traversal
def collect_reflections(association_names)
      klass = self
      association_names.each_with_object([]) do |name, ret|
        reflection = klass.reflect_on_association(name)
        if reflection.nil?
          if klass.reflection_with_virtual(name)
            break(ret)
          else
            break
          end
        end
        klass = reflection.klass
        ret << reflection
      end
    end
def collect_reflections ( association_names ) klass = self association_names . each_with_object ( [ ] ) do | name , ret | reflection = klass . reflect_on_association ( name ) if reflection . nil? if klass . reflection_with_virtual ( name ) break ( ret ) else break end end klass = reflection . klass ret << reflection end end
invalid associations return a nil
real reflections are followed
a virtual association will stop the traversal
invalid associations return a nil real reflections are followed a virtual association will stop the traversal
None
association_names