I often use ajax to update or delete objects in the controller. Now, there are the update and destroy methods, which generally look for a single id and perform actions on it. But I often need to to perform the same action to multiple objects. I can modify the update method to grab ids as an array and loop through them, to where whether it’s one id or several, it will perform the same action to each – or create a nearly identical method for update_all. Is it wise to try to use update as an update_all method, or is it confusing? The downside of an update_all method seems like it would be very similar code, but done for all.
Is update in the controller expected to always be for one object? What are best practices and what do people normally do?
I prefer not to drastically alter the conceptual behavior of the 7 “out of the box” actions. If someone else comes along and tries to work in that code they will likely be confused as to why you changed it from the normal/usual update action behavior. Instead I would add a collection route named descriptively (update_many or something like that).
Also, can you abstract out the common code to dry things out?