No commit activity in last 3 years
No release in over 3 years
Mongoid Noteable adds news feature to models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.3.0
~> 2.0.1
 Project Readme

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.