0.0
No commit activity in last 3 years
No release in over 3 years
Able to do something like 'bookmark', 'like' or 'follow' with mongoid
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

mongoid-doable

While I was working with rails and mongoid, the functions like below was necessary.

user.like(comment)
user.bookmark(course)
user.register(course)
user.follow(another_user)

While implementing these functions, I found that they all do the same thing in the model, they just have a different expression. So the mongoid-doable came out.

Installation

Using Gem

gem install mongoid-doable

Using bundler

gem 'mongoid-doable'

Examples

class Course
  include Monogid::Document
  include Monogid::Doable
  doable :like, by: :user
end
class User
  include Monogid::Document
  include Monogid::Doable
  doer :like, :course
end

user = User.create
course = Course.create

user.like!(course) # or
user.like_course!(course) # or
course.liked_by!(user) # or

user.liking_courses
user.liking_courses_count

course.likers
course.likers_count

Contributing to mongoid-doable

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2013 aproxacs. See LICENSE.txt for further details.