Tarang
Tarang

Reputation: 75975

Rails fetch url

How would I fetch a URL & its data in rails?

I've tried using open-uri:

@r = open("http://google.com/").read

This works for me in ruby but not in rails.

If you can suggest a better way to fetch a url (if there is one) let me know!

Upvotes: 3

Views: 2075

Answers (1)

James
James

Reputation: 4807

You need require 'open-uri' in order to use open on urls in Rails.

Upvotes: 5

Related Questions