How to implement notification system in RoR? - ruby-on-rails

I finished Ruby on Rails tutorial where I can follow other users and others may follow me like twitter. Now I wonder how to implement notification system if someone starts to follow me, for example, as in stackexchange or facebook in which come and display a notification (eg red 1). How to go about it? Are there any examples of ready solutions you or MVC?

I'd add a before_filter to relevant controller actions that checks for new followers in the database and sets flash[:notice] to something useful like 'X new followers' and links to your followers page. There's a quick overview of how flash works in the docs: http://api.rubyonrails.org/classes/ActionDispatch/Flash.html

Have a look at those 2 railscasts:
http://railscasts.com/episodes/407-activity-feed-from-scratch
http://railscasts.com/episodes/406-public-activity.

Related

Rails activity notification system

I've looked around StackOverflow at seemingly similar questions but nothing really seems to fit the bill.
I have a couple models that I would like users to be able to subscribe and unsubscribe to. If a user is subscribed to a video for example, they will receive notifications for things like comments.
I like the look of Github's notifications api which is built on rails but I can't seem to wrap my head around how I might replicate a similar architecture with my own models and controllers.
Please read the page I linked to above to the Github notifications API. If you think you can piece together how you might replicate this in rails please post some pseudo code of the models and the relationships they have to one another!
I don't have any experience with them, but I'd start your research here:
https://www.ruby-toolbox.com/categories/Rails_Activity_Feeds

How to get notification on the dashboard?

I have articles section in my application , and I want to show a flash notification on the dashboard for all the users who in my application if they are logged in or when they log in , when a user post a new article ?
How can I do so ? and I need an explain because I asked before and I didn't get any answers.
i need something like this !
Instead of flash messages, you seem to be looking for "One-off announcements" or "Side-wide annoucements".
Two great resources, all here listed Plugingeek, might help you.
paul_revere by thoughtbot: Simple announcement plugin to include "one off" style announcements in Rails web apps.
Site-wide annoucements RailsCast (pro)

Facebook like user search as you type

I am creating a messaging system for my web app and need help with searching for users to send messages to. So far I have it so that if you type a persons name (who is on the site) you can send a message to them. I want it to be as you start typing a persons name, a drop down appears with users names that the current user is following. Any thoughts on how I can do this?
I am using the gem mailboxer also wondering if anyone has suggestions for a better messaging gem. Thanks in advance.
Use jQuery autocomplete, and just populate the dropdown contents as all users that the user is following... something like current_user.followed_users. It's impossible to give code without seeing how your code works though.
A good alternative to jquery autocomplete is http://loopj.com/jquery-tokeninput/ and github at: https://github.com/loopj/jquery-tokeninput. A facebook like tagging to send message to multiple users. A demo app on https://github.com/railscasts/258-token-fields-revised/tree/master/bookstore-tokeninput-after from Ryan Bates from Railscasts http://railscasts.com/episodes/258-token-fields-revised
Good luck.

Rails Facebook-like Notifications

In my Rails 3 app I have Users, Products, and Likes. If a User posts a Product, and another User Likes this Product, I want that User to get a notification that their Product was Liked.
Is there an existing gem that handles this? I've only come across Pusher but that seems to be overkill.
There are a couple of gems that do that:
RailsActivity
https://www.ruby-toolbox.com/categories/Rails_Activity_Feeds
PublicActivity
http://railscasts.com/episodes/406-public-activity
https://github.com/pokonski/public_activity
I have never used them (although i probably will do it tomorrow ^^) so maybe someone with more experience can give you a better insight given your requirements (or read some part of the documentation)
All the gems that are mentioned above by different people is for implementing activity feed.There is lot of difference between implementing facebook news feed and facebook notification system.
For implementing notification system, I recommend you to check these links.
Gritter
Link
Have you seen this http://railscasts.com/episodes/260-messaging-with-faye ? Faye is used in the example. I'm not sure if you'd still consider it an overkill.

how to send notification to another user in rails

im trying to create a badge system similar to stackoverflows. i noticed that stackoverflow is able to send a notification to another user. for example, if i create a question, and 10 people upvoted my question, i receive a badge, not the current_user doing the upvoting.
how can i do that in rails? it seems sending a message to another user is out of the scope of flash messages. i did some research and maybe the faye gem seems like a possibility? however im not positive though. i was watching the railscasts and it seemed maybe better for a chatting system? is push-notification the way to go?
what would be a good way to do this? thank you
I can suggest to use this gem: https://github.com/dapi/gritter_notices
It is well handle with this problem, but it has two drawbacks:
Documentation on russian
Binding to the gritter
If you choose to use it, see what version of gritter you use. As I remember, the version of original gritter gone forward a bit.
This part of code does what you need.

Resources