0.0
No commit activity in last 3 years
No release in over 3 years
A ruby gem for adding watching to mongo documents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.10.0
 Project Readme

MongoWatchable

A simple many-to-many assocation between watchers and watchables for mongodb.

Requirements

  • MongoDB
  • MongoMapper

Installation

sudo gem install mongo_watchable

Simple Example

class User
  include MongoMapper::Document
  include MongoWatchable::Watcher
end

class Widget
  include MongoMapper::Document
  include MongoWatchable::Watchable
end

To watch it:

user.watch(widget)

Check if user is watching a widget:

user.watching?(widget)

Return count of all widgets a user is watching:

user.widget_watchings.count

Return all widgets a user is watching:

user.widget_watchings

Return all users watching widget:

widget.user_watchers

Return count of all users watching widget:

widget.user_watchers.count

Unwatch a widget

user.unwatch(widget)