You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.
Hi, Im trying to create nested reputations, however I have a relationship name that is not the default, these are my models and reputation definitions:
The reputation of an ofert is the average of the reputation of all its orders
The reputation of a user is the average of the reputation of all his oferts.
Right now is only working 1 and 2, but the reputation of an user is always 0, as you can see the relationship of users is created using an alias: has_many :created_oferts, class_name: 'Ofert'
I tried using has_reputation :total_ofert_rates, source: [{reputation: :rates, of: :oferts}]
ssoulless
changed the title
not working when association name is not the default
Use the same reputation name in aggregate of aggregates always returning 0
Dec 8, 2015
ssoulless
changed the title
Use the same reputation name in aggregate of aggregates always returning 0
[SOLVED]Use the same reputation name in aggregate of aggregates always returning 0
Dec 8, 2015
[SOLVED]
Thanks to this issue #25 I found that when you use the same reputation name it just does not work, so avoid give the same reputation name for you models.
I solved this issue just changing the name of the reputation in user.rb from rates to karma
Also make sure that you are using the exact name of your associations, for example in my case I have a has_many association with a different name than defaults:
user.rb has_many :created_oferts, class_name: 'Ofert'
So in the reputation definition I used the same name of the association: :created_oferts instead of :oferts
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, Im trying to create nested reputations, however I have a relationship name that is not the default, these are my models and reputation definitions:
order.rb
ofert.rb
user.rb
The system should work as follows:
Right now is only working 1 and 2, but the reputation of an user is always 0, as you can see the relationship of users is created using an alias:
has_many :created_oferts, class_name: 'Ofert'
I tried using
has_reputation :total_ofert_rates, source: [{reputation: :rates, of: :oferts}]
but it is not working.
It is always returning 0.0 for the reputations of the user. Im I doing something wrong?
The text was updated successfully, but these errors were encountered: