ruby on rails - activerecord-reputation-system not working -


i did small project reference quick start, when accessed reputation value error has occurred

answer.reputation_for :avg_rating

nomethoderror: undefined method `to_sym' nil:nilclass /users/juo/.rvm/gems/ruby-2.0.0-p195/bundler/gems/activerecord-reputation-system-01197ad78cac/lib/reputation_system/models/reputation.rb:189:in `get_target_type_for_sti' /users/juo/.rvm/gems/ruby-2.0.0-p195/bundler/gems/activerecord-reputation-system-01197ad78cac/lib/reputation_system/models/reputation.rb:198:in `set_target_type_for_sti' /users/juo/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:377:in `_run__3152603553061474011__validation__callbacks'` 

someone me?

let's want keep track of user karma in q&a site user karma sum of questioning skill , answering skill. questioning skill sum of votes user's questions , answering skill sum of average rating of user's answers. can defined follow:

class user < activerecord::base   has_many :answers   has_many :questions    has_reputation :karma,       :source => [           { :reputation => :questioning_skill, :weight => 0.8 },           { :reputation => :answering_skill }]    has_reputation :questioning_skill,       :source => { :reputation => :votes, :of => :questions }    has_reputation :answering_skill,       :source => { :reputation => :avg_rating, :of => :answers } end  class answer < activerecord::base   belongs_to :user, :as => :author    has_reputation :avg_rating,       :source => :user,       :aggregated_by => :average,       :source_of => [{ :reputation => :answering_skill, :of => :author }] end   class question < activerecord::base   belongs_to :user    has_reputation :votes,       :source => :user end 

try remove :as => :author answer model, , set :of => :user in initialization of has_reputation :avg_rating.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -