Guest User

Untitled

a guest
Jun 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. # Returns array of parent relationships for which this resource is child and is loaded
  2. #
  3. # @return [Array<DataMapper::Associations::ManyToOne::Relationship>]
  4. # array of child relationships for which this resource is parent and is loaded
  5. #
  6. # @api private
  7. def parent_associations
  8. parent_associations = []
  9.  
  10. relationships.each_value do |r|
  11. if r.kind_of?(Associations::ManyToOne::Relationship) && r.loaded?(self) && association = r.get!(self)
  12. parent_associations << association
  13. end
  14. end
  15.  
  16. parent_associations.freeze
  17. end
Add Comment
Please, Sign In to add comment