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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:43:59+00:00 2026-06-10T03:43:59+00:00

My app has what is effectively a constant database table. It’s big — it

  • 0

My app has what is effectively a constant database table. It’s big — it contains ~125K rows of 14 fields — and rebuilding it takes about five minutes.

For development and production work, I rebuild as part of seeding the database. But for testing, I don’t want to wait five minutes every time I run the tests.

What technique or workflow would you suggest in this case? (One approach might be to alias development_constant_table as test_constant_table for the duration of the tests, if that’s possible.)

update

I should mention that db/seeds.rb file looks something like this:

# file: db/seeds.rb
require "#{Rails.root}/db/time_dimension_loader"
TimeDimensionLoader.perform_lengthy_table_creation
  • 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-06-10T03:44:01+00:00Added an answer on June 10, 2026 at 3:44 am

    Okay, Tony Hopkinson’s pointer to stackoverflow.com/questions/1574797/ pointed the way.

    First, create a rake file:

    # lib/tasks/test_seed.rake
    namespace :db do 
      namespace :test do
        task :prepare => :environment do
          Rake::Task["db:seed"].invoke
        end
      end
    end
    

    Then when you invoke the standard rake db:test:prepare, your new rake task gets executed after the standard db:test:prepare runs. So yes, it takes a while to run the rake task, but thereafter the table is present (and persists) so you don’t have to rebuild the table every time you run RSpec or autotest.

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

Sidebar

Related Questions

My app has a function where it takes user input and then calls HttpGet
I am looking into writing an Android app that has a database of approximately
I have a simple database table (SQL Server 2008 R2 Express), which has a
My app has an options menu that is available in almost all Activities, which
My app has the ability to store passwords. But these are important passwords, so
My app has started throwing errors when I try to save a particular class
My app has an expensive service method, results of which must be 1) checked
My app has a simple signup where the user types in his/her email address
My app has been under dev for a few months and am now being
My app has to support landscape/portrait mode only for tablets, phones will only support

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.