Faced a problem completely incomprehensible to me.
I am getting an error when using the method where
.
@winner = Team.where(id: params[:winner_id])
@winner.update(rating: @winner.rating += 20)
undefined method `rating' for #<Team::ActiveRecord_Relation:0x00007faed9018490>
However, if I change @winner = Team.where(id: params[:winner_id])
to @winner = Team.find(params[:winner_id])
it will work.
Why where
method doesn't work?