Skip to content

Instantly share code, notes, and snippets.

@bassemawhoob
Created August 23, 2023 10:59
Show Gist options
  • Save bassemawhoob/931c2619a68cd3affc019f34731dbdbd to your computer and use it in GitHub Desktop.
Save bassemawhoob/931c2619a68cd3affc019f34731dbdbd to your computer and use it in GitHub Desktop.
Using FactoryBot in Rails console
# Source: https://stackoverflow.com/questions/18195851/how-do-i-use-factories-from-factorybot-in-rails-console
require 'factory_bot'
# P.S. For fabrication gem you can load the definitions in the rails console with:
# Fabrication.manager.load_definitions
FactoryBot.find_definitions
include FactoryBot::Syntax::Methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment