Search code examples
ruby-on-railsrubyurihttparty

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


i need to interpolate a variable into my url, i have tried everything i have found (using the open uri method open(), also using URI()) but nothing seems to work.

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

The variable that i need to interpolate is id. Thanks a lot for reading.


Solution

  • Your problem is that you are sending sybmol and not value. Verify the function calling Find method and assure it is value and not symbol.