ruby - Converting JSON hash into URL to be used in rails view -
i using api has url in response (a json hash). i'm trying take response, parse url , use url in link_to helper in rails view. current json parsing isn't doing trick.
# response {"url":"https://demo.foobar.net/t=54e85a9f-008b-481c-986d-69881208713e"} # controller action 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 parse json hash ensure output of rails link_to helper is:
<a href="https://demo.foobar.net/t=54e85a9f-008b-481c-986d69881208713e">click here!</a>
why converting response json , parsing again. u can value of url
@url = response["url"]
Comments
Post a Comment