Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

Can't mass-assign protected attributes: reputation_name, target_id, target_type, aggregated_by #85

Open
dcalixto opened this issue Sep 11, 2015 · 0 comments

Comments

@dcalixto
Copy link

0
down vote
favorite

I followed the http://railscasts.com/episodes/364-active-record-reputation-system

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant