This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def associations_for_includes(recursive: true, except: nil, _breadcrumb: []) | |
_breadcrumb << self.class_name | |
self.reflect_on_all_associations.map do |association_reflection| | |
association_name = association_reflection.name | |
class_name = association_reflection.class_name | |
next if _breadcrumb.include?(class_name) | |
next if association_reflection.options.has_key?(:polymorphic) | |
case except |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Maybe < BasicObject | |
UNPROXIED_METHODS = %i(__send__ __id__ send object_id extend instance_eval initialize block_given? raise caller method) | |
delegate *(::NilClass.instance_methods - UNPROXIED_METHODS), to: :@just | |
def initialize(obj) | |
@just = obj | |
end | |
# for debug |