Giter VIP home page Giter VIP logo

mongo_followable's People

Contributors

cinerama avatar lastomato avatar ryw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mongo_followable's Issues

f_type capitalize problem

Thank you for a great gem.

I'm using your gem with models like "Post" and "ChildPost".
In this case, for inherited model name, rebuild_instances() fails for "ChildPost".

How about just call constantize() without capitalize() ?

Since scope :by_type also calls type.capitalize(), it fails for "ChildPost" again.

Callbacks on follow

I'm using mongo_followable to handle not only following but favorites in my app. For both favorites and follow I use Mongoid::Observer to send notifications to users when each happens.

What I've found is it's kind of clunky. For example in order to send a notification to a User is being followed I do the following...

  def after_save(follow)
    if follow.f_type = "User" and follow.following_id_changed? and follow.following_id_was == nil
      followed = User.find(follow.f_id)
      followed.notify(:follow,
        actor: follow.following
      ) if followed
    end
  end

One thing that kind of threw me off was I wasn't sure why there are two follow documents? I thought it was for bidirectional following but it looks like when both users follow each other there are 4 documents.

The other thing I'm also wondering is if I could have favorites be in another collection. I feel like mixing them in one collection isn't optimal.

Deleted documents

When A follow B, and then B is deleted.
There will be a mongoid document not found error when we call A.all_followees

How to paginate?

The all_followers and all_followees methods seem very inefficient where there are lots of records, and since they return arrays they can't be paginated using standard Rails pagination gems.

stack level too deep

I'm getting a stack level too deep error when using the all_followers and followers_count methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.