NoMethodError: undefined method `unscoped' for Class
antulik opened this issue · comments
locate_many
does not work properly when different objects are passed.
GlobalID::Locator.locate_many ['gid://app/User/3', 'gid://app/Custom::Item/74592']
The issue User
is active_record model and responds to :unscoped, Custom::Item
is custom model and does not support :unscoped
method.
As a result the above code returns
NoMethodError: undefined method 'unscoped' for Custom::Item:Class
but works if you swap the order of objects.
as a workaround who needs it, I've added this class method to Custom::Item
class
def self.unscoped
if block_given?
yield
else
self
end
end