Module: ModelAncestry::Base

Defined in:
lib/model_ancestry/base.rb

Overview

ModelAncestry

Class Method Summary collapse

Class Method Details

.find_parent(attributes, name) ⇒ Object



6
7
8
9
10
11
# File 'lib/model_ancestry/base.rb', line 6

def self.find_parent(attributes, name)
  return unless name

  attrs = attributes.filter { |attr| attr.type == :references }
  attrs.find { |attr| attr.name.downcase == name.downcase }
end