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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:52:06+00:00 2026-05-17T14:52:06+00:00

When saving an object by calling Entity.create(:name => Entity1) from the Rails console in

  • 0

When saving an object by calling Entity.create(:name => "Entity1") from the Rails console in the testing environment (RAILS_ENV=test rails console) the “Entity1” object correctly appears in the test database (MySQL) when checking it with a mysql client.
But when doing the same stuff in an rspec file (entity.create(:name => "Entity1"); sleep 100) and checking the test database during the sleep function, it appears to be completely empty.
Why that? Where is the saved record? (I need it at that time in the database, cause of some Sphinx testing.)

I just like to add that querying the created Entity in the spec works fine (even if it doesn’t appear in the database client). So it seems that Rails does here some miracle things that I don’t really understand.

Even more strange (at least for me ;-)) … when doing a Entity.connection.commit_db_transaction() after the object was created then the record suddenly appears in the database (but is not automatically cleaned up anymore).

  • 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-17T14:52:06+00:00Added an answer on May 17, 2026 at 2:52 pm

    The solution to that problem is a feature of Rails (or RSpec … not sure about that) named Transactional Fixtures. When turning that off in the spec_helper.rb
    config.use_transactional_fixtures = false all records suddenly appear in the database after the objects are created (but that may lead to a lower test performance).

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

Sidebar

Related Questions

Where does Rails store data created by saving activerecord objects during tests? I thought
I see a similar question in Problems while saving a pre-persisted object in Google
I have two different models that need saving; a TextFile object and a static
I've encountered lately some opinions saying that Object Oriented design/programming should not always be
I recently resolved an issue my VB6 application had when saving large binary objects
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
Saving data to Postscript in my app results in a Postscript file which I
Saving and auto-filing of username/password is a feature of most modern browsers. And the
When saving data in different sql tables, is it best to use the GUID
I am saving some small images to Xml as a Byte[] via the following

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.