Make your Ruby objects Likeable with Redis
The Gowalla development team has released Likeable, a Ruby library to make it simple to add social ‘likes’ to your Ruby classes.
With just a few lines of Ruby, you can track likes using Redis as your data store:
class Comment include Likeable # ... end class User include Likeable::UserMethods # ... end comment = Comment.find(15) comment.like_count # => 0 current_user.like!(comment) # => #<Likeable::Like ... > comment.like_count # => 1 comment.likes # => [#<Likeable::Like ... >] comment.likes.last.user # => #<User ... > comment.likes.last.created_at # => Wed Jul 27 19:34:32 -0500 2011Richard Schneeman walks through an example in this screencast:
Check out the announcement or GitHub repo for more.
(Source: thechangelog)
09 / 11
Notes
-
spiele12 likes this
-
spiele12 reblogged this from thechangelog
-
davidcortes likes this
-
langarh reblogged this from thechangelog
-
rmetzler likes this
-
lankz likes this
-
pablojimeno reblogged this from thechangelog
-
urcoilbisurco likes this
-
webfocuspinas reblogged this from thechangelog
-
andion likes this
-
brianmichel reblogged this from thechangelog
-
brianmichel likes this
-
seanianjones likes this
-
schneems likes this
-
sociallife likes this
-
shortmiz reblogged this from thechangelog
-
shortmiz likes this
-
thechangelog posted this