aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit/model
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators/test_unit/model')
-rw-r--r--railties/lib/rails/generators/test_unit/model/templates/fixtures.yml2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
index 2656767eb4..0681780c97 100644
--- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
+++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
@@ -6,7 +6,7 @@
<%- if attribute.password_digest? -%>
password_digest: <%%= BCrypt::Password.create('secret') %>
<%- elsif attribute.reference? -%>
- <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default) %>
+ <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default || name) %>
<%- else -%>
<%= yaml_key_value(attribute.column_name, attribute.default) %>
<%- end -%>