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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:19:23+00:00 2026-05-29T04:19:23+00:00

I want to be able to create a few dozen users, articles (or whatever

  • 0

I want to be able to create a few dozen users, articles (or whatever resources are unique to the app), etc to see how the app looks and responds when full. This is just for testing/dev purposes, so I want to be able to roll it back, destroy it, or whatever easily. Perhaps I’m overthinking it, who knows.

I’ve seen people recommend just using a standard migration, which is one idea, but I want to do this OPTIONALLY, I don’t want everyone on the project to get the sample content as they update the app.

Other people have mentioned Factory Girl, but that looks like it might be either overkill or a side-use of a gem really designed for testing, etc. It wasn’t perfectly clear.

So what do you all do in this case?

  • 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-29T04:19:24+00:00Added an answer on May 29, 2026 at 4:19 am

    I recommend a rake task. You can stick it in lib/tasks and so everyone in the project gets it, but not everyone needs to run it, and only when it’s run will it do anything. This a great tutorial on writing rake tasks, just remember to read the part under the Rails heading in order to learn how to bring in your models.

    After that, your rake tasks is basically just ruby code. I’d suggest using the dynamic find_or_create_by methods in order to explicitly create the models you want, and if it’s run multiple times, they won’t be created multiple times. You can also choose to destroy all records in a particular model before creating them.

    I wouldn’t recommend using Factory Girl because you probably want explicit control over how your models are created.

    Here’s an example rake task to show how easy it is:

    #lib/tasks/my_task.rake
    task :fake_data => :environment do
        MyModel.find_or_create_by_name("Test")
    end
    

    Then in your console:

    rake fake_data
    

    Or:

    rake fake_data RAILS_ENV=test
    

    Ta da!

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

Sidebar

Related Questions

I'm trying to create a photo based app and I want to be able
I want to be able to create a GUID/UUID on the iPhone and iPad.
I want to be able to create an email message with an attachment, but
I want to be able to create links looking like buttons with dynamic text
I want to be able to create modal dialogs, with, for example close: function()
I want to be able to create a temporary text File in Java to
I want to be able to create the XSD file for my typed dataset
I want to be able to create a KPI List on my MOSS 2007
In Delphi, I want to be able to create an private object that's associated
Basically i want to be able to dynamically create a temp table based off

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.