Skip to content
Mike Polischuk

Tales of Triumphs and Failures in Rubyland

  • Home
  • Travel Blog

active_record

  • Home
  • active_record

Make FactoryGirl Respect Uniqueness When Creating Associations

Posted by By Mike October 11, 2017Posted inWeb Development

If you have an ActiveRecord model associated with another model that has a uniqueness constraint, modeling it in FactoryGirl when writing specs doesn’t work out of the box. But there is a simple solution.

Continue Reading
Read More
About Me

I’m Mike Polischuk, a Ruby developer that ditched the office back in 2016. Since then I’ve visited most of the countries in the Americas, while building web apps that are scalable, maintanable and easy to reason about.

Here I share quick tips on Ruby, Rails and Web development in general.

Background: co-founded Commun.it, authored the Serially and JsonApiable gems.


Follow @mikemarsian

Recent Posts
  • Introducing JsonApiable, Because Building RESTful JSON:APIs in Ruby Should Be Easier
  • Moving from ActiveModel::Serializers to FastJsonAPI
  • How to get HTTPS working on your local Rails server on Ubuntu
  • Make FactoryGirl Respect Uniqueness When Creating Associations
  • Spying on Function Calls in Jasmine Doesn’t Work as You Expect It To
Recent Comments
  • Mike on Spying on Function Calls in Jasmine Doesn’t Work as You Expect It To
  • Laura on Spying on Function Calls in Jasmine Doesn’t Work as You Expect It To
Archives
  • January 2020
  • September 2018
  • April 2018
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • March 2017
  • July 2016
Categories
  • Web Development
Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Mike Polischuk. All rights reserved. Sinatra WordPress Theme
Scroll to Top