I have an ActiveRecord user relationship to previous "voices" ...
@previous_votes = current_user.votes
I need to filter them to votes only by the current “call”, so the Ruby method selectseemed to be the best way to do this ...
@previous_votes = current_user.votes.select { |v| v.entry.challenge_id == Entry.find(params[:entry_id]).challenge_id }
But I also need to update the attributes of these records, and the method selectwill turn my relationship into an array that cannot be updated or saved!
@previous_votes.update_all :ignore => false
How can I filter my relationships, as the select method does, but not lose the ability to update / save it with ActiveRecord?
Google-like seems to named_scopeappear in all answers to similar questions, but I can’t understand that they can specifically accomplish what I need.