Method: DataMapper::Associations::Relationship#parent_model
- Defined in:
- lib/dm-core/associations/relationship.rb
#parent_model ⇒ Resource
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns model class used by parent side of the relationship
221 222 223 224 225 226 227 |
# File 'lib/dm-core/associations/relationship.rb', line 221 def parent_model return @parent_model if defined?(@parent_model) parent_model_name = self.parent_model_name @parent_model = DataMapper::Ext::Module.find_const(@child_model || Object, parent_model_name) rescue NameError raise NameError, "Cannot find the parent_model #{parent_model_name} for #{child_model_name} in #{name}" end |