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

  • SEARCH
  • Home
  • 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 3986720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:02:53+00:00 2026-05-20T06:02:53+00:00

I am writing an exporter within my current Rails3 project right now. This exporter

  • 0

I am writing an exporter within my current Rails3 project right now. This exporter has to mark every exported record as “exported” (bool). I know how to do this easily in a loop, but honestly, it doesn’t feel very good to let Rails query the database, say, 300 times in a row, just to set one field on 300 records.

Does anyone know if there’s a good way to optimize this? Should I play manually with prepared statements, or does Rails3 take care of this automagically? Is there another SQL command to do this in one step or something?

Thanks for your help

  • Arne
  • 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-20T06:02:54+00:00Added an answer on May 20, 2026 at 6:02 am

    Use update_all method on Class. From Rails API:

    # Update all books with 'Rails' in their title
    Book.update_all "author = 'David'", "title LIKE '%Rails%'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Perl CGI script right now but it's becoming a resource hog
I am writing a CSV exporter in Java that should respect the user's custom
Writing Classic ASP code in JScript has a lot going for it: more humane
Writing a python program, and I came up with this error while using the
i am writing a magento product exporter, that writes a couple of attributes into
I am writing a Win32 DLL in MSVC++2010 with exported functions. Some of those
I'm writing an exporter for Blender, and I ran into a small problem -
I am writing some test Android apps using Eclipse. I created my 1st project,
I am writing some test Android apps using Eclipse. I created my 1st project,
I'm writing an exporter for a game my friend and I are making and

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.