Blog
![](https://www.yarrait.com/sites/default/files/styles/thumbnail/public/pictures/picture-2-1320670308.jpg?itok=YMYjylWa)
We have these two gems(and many others) to get the original url from the short url.I have used both of these two gems and its works fine.
But I was getting the error like this.”URI::InvalidURIError in FoosController#foo(action)” or “bad URI for the expurrel gem” or “bad URI for the...
![](https://www.yarrait.com/sites/default/files/styles/thumbnail/public/pictures/picture-2-1320670308.jpg?itok=YMYjylWa)
A mechanize gem which provides the data extraction in a simple and easiest way in ruby on rails.
To use this gem, install it by:
gem install mechanize
than in your controller:
require 'mechanize'
agent = Mechanize.new
#...
![](https://www.yarrait.com/sites/default/files/styles/thumbnail/public/pictures/xpicture-3-1320144706.jpg.pagespeed.ic_.ULXQkdCSDB.jpg?itok=3LjWGsHP)