diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 23:01:30 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 23:02:53 -0300 |
commit | a699f5d3e18e87e802bc460b6e4d2b6fd4921884 (patch) | |
tree | 02decbc9043b60b07307e18f12da6e97b05e4a09 /railties/lib/rails | |
parent | 3456d543eba1f29e97c6c924302ea6898d9ab1d8 (diff) | |
parent | 9405ecdd98af9c8f0bd19c58a19798ebe364ed62 (diff) | |
download | rails-a699f5d3e18e87e802bc460b6e4d2b6fd4921884.tar.gz rails-a699f5d3e18e87e802bc460b6e4d2b6fd4921884.tar.bz2 rails-a699f5d3e18e87e802bc460b6e4d2b6fd4921884.zip |
Merge pull request #18309 from PaBLoX-CL/fix-fixtures-references
Generated fixtures won't use parent_id when generated with
parent:references
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/fixtures.yml | 2 |
1 files changed, 2 insertions, 0 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 f19e9d1d87..50ca61a35b 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -5,6 +5,8 @@ <% attributes.each do |attribute| -%> <%- if attribute.password_digest? -%> password_digest: <%%= BCrypt::Password.create('secret') %> + <%- elsif attribute.reference? -%> + <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default) %> <%- else -%> <%= yaml_key_value(attribute.column_name, attribute.default) %> <%- end -%> |