diff options
author | re4k <re4k@re4k.info> | 2013-04-28 00:38:21 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-04-28 00:38:21 +0900 |
commit | 4af8acda5e4664d41079e3ff2ea853e1fb74a2a8 (patch) | |
tree | 51a583486af42c349d1d0ff8cedfb40b8265fb5b /app/models/favorite.rb | |
parent | 4189cf84b0c337568133c6dafadc07669daaa868 (diff) | |
download | aclog-4af8acda5e4664d41079e3ff2ea853e1fb74a2a8.tar.gz |
refactor controller
Diffstat (limited to 'app/models/favorite.rb')
-rw-r--r-- | app/models/favorite.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/favorite.rb b/app/models/favorite.rb index de274d5..df9eb41 100644 --- a/app/models/favorite.rb +++ b/app/models/favorite.rb @@ -3,14 +3,9 @@ class Favorite < ActiveRecord::Base # counter_culture :tweet belongs_to :user - scope :order_by_id, -> do - order("id DESC") - end - def self.from_hash(hash) begin - f = create!(tweet_id: hash[:tweet_id], - user_id: hash[:user_id]) + f = create!(tweet_id: hash[:tweet_id], user_id: hash[:user_id]) logger.debug("Created Favorite: #{hash[:user_id]} => #{hash[:tweet_id]}") return f @@ -30,8 +25,6 @@ class Favorite < ActiveRecord::Base end def self.delete_from_hash(hash) - where(tweet_id: hash[:tweet_id]) - .where(user_id: hash[:user_id]) - .destroy_all + where(tweet_id: hash[:tweet_id], user_id: hash[:user_id]).destroy_all end end |