class ActiveModel::GlobalLocator
def locate(gid)
def locate(gid) if gid.is_a? GlobalID gid.model_class.find(gid.model_id) elsif properly_formatted_gid?(gid) locate GlobalID.new(gid) end end
def locate_signed(sgid)
def locate_signed(sgid) if sgid.is_a? SignedGlobalID sgid.model_class.find(sgid.model_id) else locate_signed SignedGlobalID.new(sgid) end end
def properly_formatted_gid?(gid)
def properly_formatted_gid?(gid) gid =~ /GlobalID-([^-]+)-(.+)/ end