I am using an API that has a URL in the response (a JSON hash). I'm trying to take the response, parse the URL and use the URL in a link_to helper in my rails view. My current JSON parsing isn't doing the trick.
# The Response
{"url":"https://demo.foobar.net/t=54e85a9f-008b-481c-986d-69881208713e"}
# Controller Action to Parse
@url = JSON.parse(response.to_json)
# Rails View
<%= link_to "Sign Document", @url %>
# Rendered HTML
<a href="/?url=https%3A%2F%2Fhttps://demo.foobar.net/t=54e85a9f-008b-481c-986d-69881208713e">Click Here!</a>
I need to parse the JSON hash to ensure the output of my rails link_to helper is:
<a href="https://demo.foobar.net/t=54e85a9f-008b-481c-986d69881208713e">Click Here!</a>