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 6933479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:50:16+00:00 2026-05-27T11:50:16+00:00

In $ rails console I noticed that multiple queries are being run when I

  • 0

In $ rails console I noticed that multiple queries are being run when I save a record:

ruby-1.9.2-p180 :001 > ActiveRecord::Base.logger = Logger.new(STDOUT)
 => #<...> 
ruby-1.9.2-p180 :002 > p = Project.first
 Project Load (0.3ms)  SELECT `projects`.* FROM `projects` LIMIT 1
 => #<Project id: 1, category_id: 1, qualified_at: "2011-12-14 15:06:29", ...> 
ruby-1.9.2-p180 :003 > p.qualified_at = Time.now
 => 2011-12-14 10:11:42 -0500 
ruby-1.9.2-p180 :004 > p.save
  SQL (0.2ms)  BEGIN
  SQL (1.5ms)  SHOW TABLES
  AREL (0.3ms)  UPDATE `projects` SET `qualified_at` = '2011-12-14 15:11:42', `updated_at` = '2011-12-14 15:11:47' WHERE `projects`.`id` = 1
  Category Load (0.3ms)  SELECT `categories`.* FROM `categories` WHERE `categories`.`id` = 1 ORDER BY name LIMIT 1
  ProjectPerson Load (0.4ms)  SELECT `project_people`.* FROM `project_people` WHERE (`project_people`.project_id = 1 AND (project_people.is_client = 1)) LIMIT 1
  Person Load (0.3ms)  SELECT `people`.* FROM `people` WHERE (`people`.`id` = 2)
  ProjectTag Load (0.4ms)  SELECT DISTINCT `project_tags`.tag_id FROM `project_tags` WHERE (`project_tags`.project_id = 1)
  SQL (0.5ms)  COMMIT
 => true 

I don’t have before or after filters in my Project model, and I’m not using an Observer. Obviously these queries relate to associations of the Project model, but why are the queries being run? Not sure what else to consider. Thanks.

  • 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-27T11:50:16+00:00Added an answer on May 27, 2026 at 11:50 am

    I just figured it out… I’m using the sunspot_rails gem and it was updating the index for that record 🙂 These were associations that were referenced in my index definition.

    I’ll keep the question in case anyone else happens to come across a similar problem.

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

Sidebar

Related Questions

I'm aware that I can check an ActiveRecord through the rails console but it
I know that Rails Console and IRB can be run from Tools. But how
I have noticed in Rails console that Model.search_for_ids.size != Model.all.size Moreover Thinking Shpinx method
The Rails console doesn't seem to like multiple ruby statements on the same line
After being blown away by the greatness of irb and rails console, I am
I get this error when trying ruby script/console Rails requires RubyGems >= . Please
Possible Duplicate: Ruby 1.9.2 and Rails 3 cannot open rails console I have already
I work with rails console and often i need to preload some ruby code
[gkaykck@main myApplication]$ rails console /usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
Just doing some Rails and noticed that when displaying 30 products on a single

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.