TinyURL Rails Plugin - ActsAsTinyURL

Today, I felt like making a quick little Rails plugin and what better & easier than one that ties into TinyURL's tinyurl.com URL shortening services. The service works by you submitting them a URL, and they return to you a nice shortened version that redirects to the URL that you originally submitted. I've had to integrate their services into a web application before, but I didn't see a plugin made for this, so I thought I'd whip one up called ActsAsTinyURL because it was quick and easy.

script/plugin install http://acts-as-tiny-url.googlecode.com/svn/trunk/acts_as_tiny_url


How do you use it? It's extremely simple. Once installed, open up a controller you want to use it in and put 'include ActsAsTinyURL' right underneath the class declaration.

class ApplicationController < ActionController::Base
  include ActsAsTinyURL
end


Once you've got this in place, you can start doing some quick magic.

tiny_url("http://brendanlim.com")  # => http://tinyurl.com/3274fk


Expect updates within the next few days when I get some added time in my schedule.