Module: Likeable::UserMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/likeable/user_methods.rb
Instance Method Summary collapse
-
#all_liked(klass) ⇒ Object
@user.liked(Spot) will return all spots that user has liked.
- #friend_ids_that_like(obj) ⇒ Object
- #friends_that_like(obj, limit = nil) ⇒ Object
- #like!(obj) ⇒ Object
- #like?(obj) ⇒ Boolean (also: #likes?)
- #unlike!(obj) ⇒ Object
Instance Method Details
#all_liked(klass) ⇒ Object
@user.liked(Spot)
will return all spots that user has liked
33 34 35 |
# File 'lib/likeable/user_methods.rb', line 33 def all_liked(klass) klass.all_liked_by(self) end |
#friend_ids_that_like(obj) ⇒ Object
23 24 25 |
# File 'lib/likeable/user_methods.rb', line 23 def friend_ids_that_like(obj) obj.liked_friend_ids(self) end |
#friends_that_like(obj, limit = nil) ⇒ Object
27 28 29 |
# File 'lib/likeable/user_methods.rb', line 27 def friends_that_like(obj, limit = nil) obj.liked_friends(self, limit) end |
#like!(obj) ⇒ Object
10 11 12 |
# File 'lib/likeable/user_methods.rb', line 10 def like!(obj) obj.add_like_from(self) end |
#like?(obj) ⇒ Boolean Also known as: likes?
18 19 20 |
# File 'lib/likeable/user_methods.rb', line 18 def like?(obj) obj.liked_by?(self) end |
#unlike!(obj) ⇒ Object
14 15 16 |
# File 'lib/likeable/user_methods.rb', line 14 def unlike!(obj) obj.remove_like_from(self) end |