Need recommendations to create an event-based messaging and badging system in Rails

I want to create an event-based notification and badging system that would award users when they accomplish certain goals. Goals might include:

  • Posting 20 entries on a forum -> alert on homepage highlighting user, award of badge
  • Logging in to the site 10 days straight -> congrats to message to user on homepage
  • Commenting on 10 forum posts -> forum badge award

Would this be a job for a state machine such as AASM? I haven't played much with such systems. Would that be the way to go to define events or are there better plugins/solutions that would accommodate this type of behavior? Any tutorials or recommendations for approach would be greatly appreciated.

-------------Problems Reply------------

It seems that the tricky part here is figuring out how you want to maintain the state needed to determine when a badge should be awarded. The state machine plugins for rails aren't going to help you much with that.

For example, how would a piece of code determine if a user has logged in 10 days straight? Once you figure this out then you can worry about how to organize the event handling.

Do you need to notify them in real time when they get a badge? If so they then you can easily do this with ActiveRecord::Observer but it may have some latency issues in thelong run (http://api.rubyonrails.org/classes/ActiveRecord/Observer.html)

If you don't need to do it in real time then you can do it with background jobs of some form. There are a lot of libraries for background jobs out there. I use workling when I don't care about scaling and just want to get something up fast.

Category:ruby Views:0 Time:2010-02-12

Related post

  • create an event based on another event 2012-04-29

    I have a recurring event (City Council meeting every second Thursday) and need to create another event two days before it (Work session on prior Tuesday). If I use a recurring event on the second Tuesday in months that start on Wednesday or Thutsday,

  • Creating a web based point of sale system 2012-04-19

    I am considering of prototyping a web based point-of-sale system. I don't have programming skills but I'm thinking of using this project in order to learn. I would like to ask you the following two questions: Do you think the above task is achievable

  • RabbitMQ C# API Event based Message Consumption 2010-08-10

    while (true) { BasicDeliverEventArgs e = (BasicDeliverEventArgs)Consumer.Queue.Dequeue(); IBasicProperties properties = e.BasicProperties; byte[] body = e.Body; Console.WriteLine("Recieved Message : " + Encoding.UTF8.GetString(body)); ch.BasicAck(e.D

  • Is Lua an event-based programming language? 2011-05-31

    Is Lua event-based or thread-based? I've been reading a lot about Node.js lately, and it appears that one of the the largest selling points for it is related to it being event-based as opposed to thread-based. What is Lua? --------------Solutions----

  • Event log message file issue 2012-02-27

    One of the applications I work on has been spitting out ugly event log messages that have our message but also the wonderful message such as below: The description for Event ID 103 from source MyCustomSource cannot be found. Either the component that

  • Rails how to create Jquery flash message instead of the default rails message 2011-06-28

    I want to create a custom Jquery message instead of the standard rails flash message at the top of my page. I want to create a flash message near my vote up bottom. My controller: def vote_up @post = Post.find(params[:id]) current_user.up_vote(@post)

  • PHP based in-website mailing system 2010-02-06

    I know this question is rather vague, but how do I proceed about creating a php based in website mailing system in a community website? Any input would be appreciated. I don't know how to start. Thanks in advance. --------------Solutions-------------

  • Is it possible to create a adobe air android app that takes control the phones ring and creates it own based off of a text message? 2011-11-11

    Good afternoon I was wandering if this is possible to do with adobe air. I have a interesting idea to create a app with air that creates a ring based on the content of a text message but i was wandering is this even possible. I am learning adobe air

  • Python twisted event based jabber/xmpp/email/irc/chat client that listens and responds to messages 2012-03-09

    I am looking to have my client "react" to a received message through some xml based communications medium. I was looking into xmpp with google talk, but I just need something that can quickly relay messages on an event based basis (i.e. without havin

  • MMC could not create the snap-in message on device manager, event viewer and all other administrative tools 2013-03-05

    i have Win7 64bit enterprise license. I'm experiencing the most famous Windows bug of all: "MMC could not create the snap-in" message when trying to open the device manager, event viewer and all other administrative tools. i know it is famous because

  • Can you create custom events on non-UIComponent based objects in Flex 3? 2009-01-14

    I have a simple object that get's geocoding data from the Google Maps API and I'd like it to dispatch a set of custom events depending on the response from Google. However, I don't have the addEventListener() and dispatchEvent() methods on this class

  • Creating user events on certain actions. What is recommended solution? 2011-05-29

    This question regards how one can effectively create and persist event domain objects on certain system or user triggered events which themselves may or may not persist changes to the database. Im creating a system where a user can tag some object, a

  • How do I create an event receiver for a single list that is based on a custom content type? 2011-09-14

    I am trying to create an event receiver for a list I have created called Questions. When a new question is added I want an event to fire. I have looked into it so I know I need to create an event receiver and make use of the ItemAdded method. How do

  • How do you create an event log source using WiX 2008-09-12

    I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation. Does anyone know the best way to do this using the WiX framework. --------------Sol

  • Events and messages in mfc 2009-03-29

    I am a bit confused about the difference between events and messages in mfc. Are they the same? --------------Solutions------------- Since you specifically ask about MFC, I assume you mean the event handlers and message handlers that you can define i

  • How to represent an event based architecture in a static UML model? 2009-07-13

    I have a fairly basic C# event based system but I'm not sure how I model it in UML. I obviosuly want to show the event publisher, subscriber, handlers and EventArgs classes .. I think you use 'signals' but I can't find any examples. Can anyone point

  • Xcode unable to create new "Window-based application" iphone app from template 2010-06-30

    I'm trying to create a new "Window-based Application" in Xcode and I'm getting the following message: Internal Error File: /SourceCache/DevToolsIDE/DevToolsIDE-1688/pbxinterface/Wizards.subproj/PBXWizardChooserWizard.m Line: 1365 Object: <PBXProje

  • How would I go about implementing the event-based asynchronous pattern? 2010-11-18

    Hi I want to implement the event-based asynchronous pattern using c#. The Microsoft documentation below is really helpful but quite rightly it leaves out the implementation details. http://msdn.microsoft.com/en-us/library/ms228969.aspx What are my op

  • Node.js: event-based comet insted of periodic ajax requests? 2011-08-11

    Core features of node.js as far as I understood are (also): event-based structure and very cheap "threads" sleeping. So, it may be really good idea (and probably cheaper) to do not create periodic ajax requests, but to hold events like "user A got a

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.201 (s). 11 q(s)