如何修复这个小坏 URI(不是 URI?)错误?

how to fix this little bad URI(is not URI?) error?

我需要在我的 url 中插入一个变量,我已经尝试了我发现的所有方法(使用打开 uri 方法 open(),也使用 URI())但似乎没有任何效果。

  def self.find(id)
    HTTParty.get("http://localhost:3000/api/v1/users/#{id}.json", format: :json)
  end

我需要插值的变量是id。 非常感谢阅读。

您的问题是您发送的是 sybmol 而不是值。验证调用 Find 方法的函数并确保它是值而不是符号。