Sha256: f01624d0726c758bc84bda963ca3228c677cc60a15ba804d8e573f6ffe7937a6

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

= Follow feature for Rails3 with Mongoid

== Installation

In Gemfile:
  gem 'mongoid_follow'

== Legend (to ease complications)

  "follower" is a model who follows
  "followee" is a model who would be followed

== To use

To make mongoid_follow usable you need to include Mongoid::Followee into your document who would be followed then you also need to include Mongoid::Follower in your follower model:

  class User
    include Mongoid::Document

    include Mongoid::Followee
    include Mongoid::Follower
  end

  class Group
    include Mongoid::Document

    include Mongoid::Followee
  end

You can then follow a model using:

  @bonnie = User.create
  @clyde = User.create

  @bonnie.follow(@clyde)
  @bonnie.unfollow(@clyde)

You can also see whether a model is a follower of another model or if a model is a followee of another model:

  @clyde.follower?(@bonnie)
  @bonnie.followee?(@clyde)

You can also be a follower of other models

  @gang = Group.create
  @bonnie.follow(@group)

  @gang.follower?(@bonnie)
  @bonnie.follows?(@gang)

* Any bug or issue, please send me an email to aeguintu@gmail.com

== For development

  gem install 'mongoid'
  gem install 'bson_ext'
  gem install 'database_cleaner'
  gem install 'rspec'

  rake spec/specs/follow_spec_rb

== TODO

* finish up todo's (list of followers and followees) ==FINISHED
* count of followers/followees ==FINISHED
* common followers (or maybe followees) ==FINISHED

== Thanks

Super thanks:
to mongoid_followable.
to Tristan Peralta.

== Copyright

Copyright (c) Alec Guintu. See LICENSE.txt for further details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid_follow-0.2.0 README.rdoc
mongoid_follow-0.1.0 README.rdoc