@@ -127,7 +127,7 @@ def _create_has_many_links(association_type, association_key_values)
127127 association = self . class . _associations [ association_type ]
128128
129129 association_key_values . each do |association_key_value |
130- related_resource = Resource . resource_for ( association . type ) . find_by_key ( association_key_value , context : @context )
130+ related_resource = Resource . resource_for ( self . class . module_path + association . type . to_s ) . find_by_key ( association_key_value , context : @context )
131131
132132 # ToDo: Add option to skip relations that already exist instead of returning an error?
133133 relation = @model . send ( association . type ) . where ( association . primary_key => association_key_value ) . first
@@ -203,11 +203,6 @@ def inherited(base)
203203 base . attribute :id , format : :id
204204
205205 check_reserved_resource_name ( base . _type , base . name )
206-
207- # If eager loading is on this is how all the resource types are setup
208- # If eager loading is off some resource types will be initialized in
209- # _resource_name_from_type
210- @@resource_types [ base . _type ] ||= base . name . demodulize
211206 end
212207
213208 def resource_for ( type )
@@ -518,6 +513,7 @@ def check_reserved_association_name(name)
518513
519514 def _associate ( klass , *attrs )
520515 options = attrs . extract_options!
516+ options [ :module_path ] = module_path
521517
522518 attrs . each do |attr |
523519 check_reserved_association_name ( attr )
0 commit comments