Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6371201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:01:55+00:00 2026-05-25T01:01:55+00:00

I often use ajax to update or delete objects in the controller. Now, there

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:01:55+00:00Added an answer on May 25, 2026 at 1:01 am

    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?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While debugging jQuery apps that use AJAX, I often have the need to see
I often use gVim and Vim to view data tables in which the top
i often use but i have this problem. if there is a whose action
We often use stacks or queues in our algorithms, but are there any cases
I often use textboxes in my wpf-projects which are bound to datetime-propertys. I want
I often use the find command to search through source code, delete files, whatever.
In order to use some AJAX calls, we use often some input type=hidden. But
I often use links with href='#' when calling ajax resources. I noticed that IE
I often use webservice this way public void CallWebservice() { mywebservice web = new
I often use the top command to see what is taking up resources. Mostly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.