jeudi 10 septembre 2015

Twitter Reputation System Gem Can't mass-assign protected attributes

I followed the http://ift.tt/NbOPyK

on my User model i Have:

has_many :evaluations, class_name: "RSEvaluation", as: :source

has_reputation :votes, source: {reputation: :votes, of: :articles}, aggregated_by: :sum

def voted_for?(article)
  evaluations.where(target_type: article.class, target_id: article.id).present?
end

Article model i have:

has_reputation :votes, source: :user, aggregated_by: :sum

And Article controller:

def vote
  value = params[:type] == "up" ? 1 : -1
  @article = article.find(params[:id])
  @article.add_or_update_evaluation(:votes, value, current_user)
  redirect_to :back
end

But when i go voting shows:

Can't mass-assign protected attributes: reputation_name, value, source_id, source_type, target_id, target_type

Anyone is having the same issue with this gem?

Aucun commentaire:

Enregistrer un commentaire