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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:47:17+00:00 2026-06-13T12:47:17+00:00

Just started using factory girl. If one has to save a factory into the

  • 0

Just started using factory girl. If one has to save a factory into the db then one has to run
FactoryGirl.create().

But is there any way to load a collection of factories into the database without having to call create on each of the factories?

If its of any help i’m using Ruby 1.9.3, Rails 3.2.8 and Factory Girl 4.1.

  • 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-13T12:47:18+00:00Added an answer on June 13, 2026 at 12:47 pm

    If you need a bunch of factories of different type, you’ll simply have to create them individually. You can make this a bit less verbose by adding this to your test_helper.rb:

    include FactoryGirl::Syntax::Methods
    

    Then you can create factories like this:

    create(:factory_name)
    

    And of course, if you need a bunch of records of the same type, you can create them like this:

    5.times { create(:factory_name) }
    

    As mentioned in my comment, creating all your factories in one fell swoop on initialization of your test framework is counter-productive. The idea behind FactoryGirl is to provide just the data you need for each test case or context. This avoids dependencies between tests that tend to slip into a fixture-driven approach.

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

Sidebar

Related Questions

I just started using the latest build of ffmpeg into which ffmpeg-mt has been
I just started using gApps scripts and I have run into two problems with
just started using log4j in one of my home-projects and I was just about
Just started using Blueprint CSS and now playing with the grids but have a
Just started using CodeIgniter, loving it. Having enabled the database to be one of
Just started using fadein/fadeout - it's functioning but with problems. I have a set
Just started using App Engine's webapp framework, but I can't figure out what's wrong
I'm using FFTW to analyze elevation data, but I started out just by looking
Just started using carrierwave with Rails and things have been going smoothly with one
just started using JPA today, so i'm preety new to it. How would one

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.