Closed sebasjimenez10 closed 11 months ago
Hey @gaorlov 👋 hope you can take a look at this one as well 🙂 thanks in advance!
@sebasjimenez10 thanks for the contribution!
This looks very similar to the built in class_name
functionality?
module CrossNamespaceOne
class Hammer < TestResource
property :brand
has_many :nails, class_name: 'CrossNamespaceTwo::Nail'
end
end
would that work for your usecase?
@gaorlov thanks for the response! I went ahead and commented the changes I made to utils.rb
and used class_name
but I still got the:
NameError: uninitialized constant CrossNamespaceOne::Hammer::Nail
error.
Any ideas on why? I'm happy to try something else! 🙏
@gaorlov small bump on this one as well! 🙏
@gaorlov thanks for the reply! Merged in main into the branch and added the changelog updates!
@gaorlov small bump! 🙏
@sebasjimenez10 I'm on a trip right now, but i will merge and release a new version when I'm back next week. Thank you for your contributions and patience!
@gaorlov small bump! we're almost there! 🙏
hello!
Sorry about the delay! this is now available in 1.22.0
Thank you so much for your contribution!
Hey there,
I'm opening this PR because I noticed an issue with the way the association class types are being looked up when including related resources.
I discovered this when having cross-referenced types when using namespaces, like the example suggests:
In this case whenever the IncludedData class was initializing an instance, the utils class would not be able to produce a correct type to use for the related included type producing an error similar to the following:
Since one should be able to add options to the association definition the
class
option makes sense here. This PR makes use of that to try and figure out the appropriate type before defaulting to the existing behavior.Thanks in advance for taking a look!