public
Created

TwitterNotification & TwitterService

  • Download Gist
twitter_service.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class TwitterNotification < ActiveRecord::Observer
observe :post
 
def after_create post
TwitterService.send_tweet post.subject
end
end
 
class TwitterService
def self.send_tweet subject
twitter = Twitter.login(username, password)
twitter.send_tweet generate_tweet_from_subject(subject)
end
...
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.