diff options
author | Rhenium <rhenium@rhe.jp> | 2013-11-17 11:21:57 +0900 |
---|---|---|
committer | Rhenium <rhenium@rhe.jp> | 2013-11-17 11:21:57 +0900 |
commit | 31aabeb149cbefa915775d4c58623b731059c3cf (patch) | |
tree | ceeb415a0d4bb1db523fb2e28735c4ca72419537 /app/models/tweet.rb | |
parent | ddb1a321dda6e6d5e9867f38129fea44eafb2135 (diff) | |
download | aclog-31aabeb149cbefa915775d4c58623b731059c3cf.tar.gz |
add in_reply_to support
Diffstat (limited to 'app/models/tweet.rb')
-rw-r--r-- | app/models/tweet.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/tweet.rb b/app/models/tweet.rb index 0954906..f08ab97 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -1,6 +1,9 @@ class Tweet < ActiveRecord::Base belongs_to :user + belongs_to :in_reply_to, class_name: "Tweet" + has_many :replies, class_name: "Tweet", foreign_key: "in_reply_to_id" + has_many :favorites, -> { order("favorites.id") }, dependent: :delete_all has_many :retweets, -> { order("retweets.id") }, dependent: :delete_all @@ -83,6 +86,7 @@ class Tweet < ActiveRecord::Base text: msg["text"], source: msg["source"], tweeted_at: Time.parse(msg["tweeted_at"]), + in_reply_to_id: msg["in_reply_to_status_id"], user: u) end logger.debug("Created Tweet: #{msg["id"]}") |