Reputation: 203
I installed the gem Bitly into my rails app
I did it by running gem install bitly
then I manually added gem 'bitly'
into my gemfile
I created this inside `config\initializers\bitly.rb
Bitly.configure do |config|
config.api_version = 3
config.login = "myusername"
config.api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
end
I'm trying to get my rails server running but I get this error I've never seen before
Exiting
C:/app/config/initializers/bitly.rb:1:in `<top (
required)>': undefined method `configure' for Bitly:Module (NoMethodError)
How can I resolve this issue and make this gem work?
I am trying to use the gem inside one of my models
bitly.shorten("http://mydomain.com/article/#{id}")
Upvotes: 0
Views: 1683
Reputation: 13574
Bitly is currently available in version 0.8.1 on rubygems. This version does not support Bitly.configure
. I recomend you use the gem from github, until someone releases a newer version on rubygems.
The bitly line in your Gemfile
should look like this:
gem "bitly", :git => 'https://github.com/philnash/bitly/'
Then do a bundle install
and bitly should work the way you expect.
Edit: There is even a github issue for that error :)
Upvotes: 1