Skip to content

lastomato/mongoid_noteable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongoid_noteable

acts just like facebook’s news feed(recommend to be used with mongoid_followable)

Installation

In console:

gem install mongoid_noteable

or in Gemfile:

gem 'mongoid_noteable', "~> 0.0.1"

Usage

To make model noteable you need to include Mongoid::Noteable into your document. Using it accompany with mongoid_followable is recommended.

class User
  include Mongoid::Document
  include Mongoid::Follower
  include Mongoid::Noteable
end

class Group
  include Mongoid::Document
  include Mongoid::Followable
end

Now you can spread news in your controller:

...
  # This is what mongoid_followable does
  @group = Group.new
  @group.save

  current_user.follow(@group)

  # Below is what mongoid_noteable does
  current_user.add_news(@group.name, "published", @some_post.name, 1)
  current_user.all_news
  current_user.recent_news
  current_user.highlight_news
  current_user.news_with_subject(@group.name)
  current_user.news_with_action("published")
  current_user.news_with_object(@some_object.some_attribute)

  current_user.all_followers.all_news # get all followers' news
...
  • Any bug or issue, please send me an email: ustc.flyingfox@gmail.com

TODO

  • fix bug in test #FINISHED#

  • add highlight feature #FINISHED#

  • news_like_* methods for fuzzy search

  • more fields(Besides “subject”, “action” and “object”) in News.

(If you have any idea, advice or suggestion, don’t hesitate to contact me!)

Copyright © Jie Fan. See LICENSE.txt for further details.

About

adds news feed feature to models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages