Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8635173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:54:30+00:00 2026-06-12T09:54:30+00:00

Note: I am following http://railscasts.com/episodes/364-active-record-reputation-system for this example. I have a Location model where

  • 0

Note: I am following http://railscasts.com/episodes/364-active-record-reputation-system for this example.

I have a Location model where I am letting the user rank (i.e. 1 to 5 stars) the item:

has_reputation :location_rating, source: :user, aggregated_by:
:average

In my controller I am either deleting the rating:

@location.delete_evaluation(:location_rating, current_user)

or updating it:

@location.add_or_update_evaluation(:location_rating, params[:rating] , current_user)

I am brutally confused how to query:

  • the current average rating of a Location by all users
  • the rating of a given Location by a given user
  • the count of ratings on a given Location

I am trying @location.reputation_for(:location_rating) and getting some weird behavior. If a given user deletes a rating and then the new reputation_for value seems to averaging in the old ratings.

For example:

1.9.3p0 :038 > RSEvaluation.all
RSEvaluation Load (1.7ms) SELECT "rs_evaluations".* FROM "rs_evaluations" 
+----+-----------------+-----------+-------------+-----------+-------------+-------+-------------------------+-------------------------+
| id | reputation_name | source_id | source_type | target_id | target_type | value | created_at | updated_at |
+----+-----------------+-----------+-------------+-----------+-------------+-------+-------------------------+-------------------------+
| 46 | tracking | 1 | User | 6 | Location | 0.0 | 2012-08-28 05:15:13 UTC | 2012-08-28 05:15:13 UTC |
| 48 | tracking | 1 | User | 5 | Location | 0.0 | 2012-09-04 14:44:37 UTC | 2012-09-04 14:44:37 UTC |
| 51 | tracking | 1 | User | 8 | Location | 0.0 | 2012-09-12 06:51:58 UTC | 2012-09-12 06:51:58 UTC |
| 52 | tracking | 1 | User | 1 | Location | 0.0 | 2012-09-12 14:54:39 UTC | 2012-09-12 14:54:39 UTC |
| 54 | location_rating | 1 | User | 5 | Location | 3.0 | 2012-09-19 05:10:46 UTC | 2012-09-19 05:18:16 UTC |
| 56 | tracking | 11 | User | 5 | Location | 0.0 | 2012-09-19 05:47:10 UTC | 2012-09-19 05:47:10 UTC |
| 58 | location_rating | 11 | User | 3 | Location | 2.0 | 2012-09-19 06:33:12 UTC | 2012-09-19 06:33:12 UTC |
| 61 | location_rating | 11 | User | 5 | Location | 5.0 | 2012-09-19 07:15:42 UTC | 2012-09-19 07:15:42 UTC |
+----+-----------------+-----------+-------------+-----------+-------------+-------+-------------------------+-------------------------+

On Location id = 5 should my reputation not be (3 + 5) / 2 = 4? I currently get 2.59375. I update User 11’s rating to 1 and the new reputation is 0.59375.

I am sure I am missing something obvious here (as I am a Rails newbie).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:54:32+00:00Added an answer on June 12, 2026 at 9:54 am

    Version 2.0.0 has a fix for this problem so you should update your gem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading the following article: http://java.sun.com/docs/hotspot/gc1.4.2/example.html and have trouble understanding the following lines:
I am combining div toggling with complex forms: http://railscasts.com/episodes/75-complex-forms-part-3 My specific situation: I have
I am following this tutorial http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/ note: yes I know I did install hadoop
* Tears hair out * I've been following this - http://msdn.microsoft.com/en-us/library/ee554869.aspx walkthrough to set
Can someone please derive a concrete example from the following: http://www.urdalen.com/blog/?p=210 ..that shows how
i have the following string: http://pastebin.com/d29ae565b i need to separate each value and put
I have a url that is easily accessible when you request it as: http://example.com/2005/01/example.html
I have the following HTML code (note no closing tags on <\option> ) generated
I'm trying to change instances of the following line: URL: http://www.google.com/?s= test to URL:
Please take a look at the following fiddle: http://jsfiddle.net/ellenchristine/tty3e/ Note that when you expand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.