Class: Tweet
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Tweet
- Includes:
- Twitter::Autolink
- Defined in:
- app/models/tweet.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_by_tweet_id(tweet_id) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/tweet.rb', line 21 def self.find_by_tweet_id(tweet_id) if Tweet.exists?(:tweet_id => tweet_id.to_s) Tweet.where(:tweet_id => tweet_id.to_s).first else status = Twitter.status(tweet_id) tweet = Tweet.new tweet.text = status.text tweet.tweet_created_at = status.created_at tweet.tweet_id = status.id tweet.user_name = status.user.name tweet.user_screen_name = status.user.screen_name tweet.user_profile_image_url = status.user.profile_image_url tweet.save! tweet end end |
Instance Method Details
#text ⇒ Object
13 14 15 |
# File 'app/models/tweet.rb', line 13 def text auto_link(self[:text]) end |
#user_profile_image_url=(url) ⇒ Object
17 18 19 |
# File 'app/models/tweet.rb', line 17 def user_profile_image_url=(url) self[:user_profile_image_url] = url.sub("_normal", "_reasonably_small") end |