From 7e4440166713b176f73fe9f64db12704d99747a1 Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Wed, 15 May 2019 15:28:43 +0900 Subject: [PATCH] Fix definition_file_paths setting for Rails engine --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 754f3da..92800ed 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,14 @@ This will cause factory\_bot\_rails to automatically load factories in It is possible to use this setting to share factories from a gem: ```rb +begin + require 'factory_bot_rails' +rescue LoadError +end + class MyEngine < ::Rails::Engine config.factory_bot.definition_file_paths = - File.expand_path('../factories', __FILE__) if defined?(FactoryBotRails) + [File.expand_path('../factories', __FILE__)] if defined?(FactoryBotRails) end ```