FactoryBot.define do factory :<%= name %>, class: <%= record.class %> do <% columns.each do |column| %> <% quote = FactoryBotGenerator::QUOTE_AROUND_VALUE_TYPES.include?(record.class.columns_hash[column].type) %> <%= "%-#{indent}s" % column %> <%== "'" if quote %><%== record.public_send(column) %><%== "'" if quote %> <% end %> end end