Skip to content
Add likes to your Mongoid documents
Branch: master
Clone or download
Pull request Compare This branch is 9 commits behind diowa:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Gem Version Build Status Dependency Status Code Climate Coverage Status

Add like to your Mongoid documents. This is a fork of tombell/mongoid-voteable for people who only need likes.


Install the gem

$ gem install mongoid-likeable

or add the gem to your Gemfile

gem 'mongoid-likeable'

Thread safety

This gem is thread safe.


Include the Mongoid::Likeable module into your models you want to like.

class Story
  include Mongoid::Document
  include Mongoid::Likeable

  # ...

You can then like by simply using the like method on the model. @user   # @user likes @story
@story.unlike @user # @user doesn't like @story anymore

You also have access to a helpful method.

@story.liked? @user # true if @user likes @story

Like count is stored in a field called likes, so you can sort models by that field.

Note if your users are not stored in a Mongo collection or the ID field is not called _id you can still pass the ID in as the second parameter instead.



Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

More over, if your pull request contains patches or features, you must include relevant unit tests.

Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at


For transparency and insight into our release cycle, and for striving to maintain backward compatibility, mongoid-likeable will be maintained under the Semantic Versioning guidelines as much as possible. mongoid-likeable will not follow mongoid's version number.

Releases will be numbered with the following format:


And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit


Geremia Taglialatela

Cesidio Di Landa

Copyright and license

Copyright 2014 diowa under the BSD 2-Clause license.

mongoid-voteable is licensed under the MIT License - Copyright (c) 2012 Tom Bell

You can’t perform that action at this time.