Module: Sequel::Plugins::DetectUnnecessaryAssociationOptions::ClassMethods

Defined in:
lib/sequel/plugins/detect_unnecessary_association_options.rb

Instance Method Summary collapse

Instance Method Details

#detect_unnecessary_association_optionsObject

Check for unnecessary association options.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/sequel/plugins/detect_unnecessary_association_options.rb', line 67

def detect_unnecessary_association_options
  @association_reflections.each_value do |ref|
    meth = "detect_unnecessary_association_options_#{ref[:type]}"
    # Expected to call private methods.
    # Ignore unrecognized association types.
    # External association types can define the appropriate method to
    # support their own unnecessary association option checks.
    if respond_to?(meth, true)
      # All recognized association types need same class check
      _detect_unnecessary_association_options_class(ref)
      send(meth, ref)
    end
  end

  nil
end

#finalize_associationsObject

Implicitly check for unnecessary association options when finalizing associations.



60
61
62
63
64
# File 'lib/sequel/plugins/detect_unnecessary_association_options.rb', line 60

def finalize_associations
  res = super
  detect_unnecessary_association_options
  res
end