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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:58:31+00:00 2026-05-18T11:58:31+00:00

In my Rails 3 application, I have a User model with the following fields

  • 0

In my Rails 3 application, I have a User model with the following fields

   name: string
   email: string
   children: has_many association to another model

I’m using machinist 2 to generate mock data, its blueprint looks like

User.blueprint do
   name { 'user{sn}' }
   email { '{object.name}@domain.com' }
end

And User’s Unit Test:

require 'test_helper'

class UserTest < ActiveSupport::TestCase
  should have_many( :children )
  should validate_uniqueness_of( :email )
  should_not allow_value("blah").for(:email)
  should_not allow_value("b lah").for(:email)
  should allow_value("a@b.com").for(:email)
  should allow_value("asdf@asdf.com").for(:email)
end

When I generated the user model, it created a fixture file. My understanding is that when I run rake, Rails uses that fixture file to generate objects used in the tests. Which is not what I want. I want Rails to use machinist’s blueprints just a seamlessly as it uses the fixtures file.

Is there a way to do this? Is there some way to tell rails that it needs to use blueprints instead of fixtures?

  • 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-18T11:58:32+00:00Added an answer on May 18, 2026 at 11:58 am

    Add this to config/application.rb:

    config.generators do |g|
      g.fixture_replacement :machinist
    end
    

    You can safely trash the old fixtures folder too, unless you want to keep them obviously!

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

Sidebar

Related Questions

My Rails application have a User model and a Group model, where User belongs
I have a rails application where each user has a separate database. (taking Joel
I have a rails application which is still showing the cachebusting numeric string at
I'm building Rails application and I want to have user registration/login functionality. I also
In my application I have an extended User model called UserProfile. This user can
I have a Rails 3 application with a User class, and a tab-delimited file
I am working on a rails application (I have some experience with rails). But,
I've got a rails application where users have to log in. Therefore in order
I'm looking at building a Rails application which will have some pretty large tables
I have a rails application running on a Linux server. I would like to

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.