How do I create a point system in a Rails app that assigns points to users and non-authenticated-use

Posted by codyvbrown on Stack Overflow See other posts from Stack Overflow or by codyvbrown
Published on 2010-06-15T00:26:07Z Indexed on 2010/06/15 0:32 UTC
Read the original article Hit count: 204

Filed under:
|

I'm building a question and answer application on top of twitter and I'm hitting some snags because I'm inevitably dealing with two classes of users: authenticated and non-authenticated.

The site enable users to give points to other users, who may or may not be authenticated, and I want to create a site-wide point system where the application stores and displays this information on their profile.

I want to save this point data to the user because that would be faster and more efficient but non-authenticated users aren't in our system, we only have the twitter handle. So instead we display the points in our system like this:

  @points =  point.all(
:select => "tag, count(*) AS count",  # Return tag and count
 :group => 'tag',                   # Group by the tag
  :order => "2 desc",
 :conditions => {:twitter_handle => params[:username]})

Is there a better way to do this? Is there a better way to associate data with non-authenticated users?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about twitter-api