module GovernorTwitter::Controllers::Methods

Public Class Methods

included(c) click to toggle source
# File lib/governor_twitter/controllers/methods.rb, line 4
def self.included(c)
  c.after_filter :send_to_twitter, :only => [:create, :update]
end

Public Instance Methods

send_to_twitter() click to toggle source
# File lib/governor_twitter/controllers/methods.rb, line 8
def send_to_twitter
  if params[:post_to_twitter] && resource.errors.blank?
    content, url = params[:twitter_content], polymorphic_url(resource)
    logger.info 'posting to twitter in the background'
    GovernorBackground.run('twitter_post', content, url)
  end
end