Setting up the get_shorty plugin for bit.ly shortlinks on rails

153 views Asked by At

I'm trying to get bit.ly shortlinks to link to one of my model's show pages for Twitter functionality that I want to incorporate into my app.

It seems like the https://github.com/playgood/get_shorty is the best thing I could find out there, but I'm having trouble setting it up.

I think this is where my problem is, but I"m stumped:

class Foo < ActiveRecord::Base

    include GetShorty  
    has_short_url :long_url_host => "localhost:3000" :long_url_method => #What should I put here?

The plugin documentation "this would probably be a resourceful route helper method for example page_url"

How would I set that up? Do I include routes.rb into the model and use the helper method?

1

There are 1 answers

1
pjammer On

The plugin didn't mention this long_url_host in the README, but try it with the bit.ly api as intended instead.

you should just set up your api_key and credentials in an intitializer and put the has_short_url in the model.