Module: GovernorTwitter::Controllers::Methods

Defined in:
lib/governor_twitter/controllers/methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(c) ⇒ Object



4
5
6
# File 'lib/governor_twitter/controllers/methods.rb', line 4

def self.included(c)
  c.after_filter :send_to_twitter, :only => [:create, :update]
end

Instance Method Details

#send_to_twitterObject



8
9
10
11
12
13
14
# 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