Undefined method `update_attributes'?
mongodb, mongoid, ruby-on-rails, ruby-on-rails-4
Solution
You want to fetch one record in particular, so tell it:
update_vote = Vote.where(comment_id: @comment.id).first
but this code is prone to errors if nothing matches, beware.
Problem
Why do I get this error? I'm out of ideas. `undefined method `update_attributes' for #` Code: ``` exists = Vote.where(comment_id: @comment.id).exists? if exists update_vote = Vote.where(comment_id: @comment.id) update_vote.update_attributes(value: 5) redirect_to :back else ```