diff options
Diffstat (limited to 'railties/lib/rails/generators/test_unit/model/templates/fixtures.yml')
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/fixtures.yml | 22 |
1 files changed, 10 insertions, 12 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 7625ff975c..f19e9d1d87 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -1,22 +1,20 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html <% unless attributes.empty? -%> -one: +<% %w(one two).each do |name| %> +<%= name %>: <% attributes.each do |attribute| -%> - <%= attribute.column_name %>: <%= attribute.default %> - <%- if attribute.polymorphic? -%> - <%= "#{attribute.name}_type: #{attribute.human_name}" %> + <%- if attribute.password_digest? -%> + password_digest: <%%= BCrypt::Password.create('secret') %> + <%- else -%> + <%= yaml_key_value(attribute.column_name, attribute.default) %> <%- end -%> -<% end -%> - -two: -<% attributes.each do |attribute| -%> - <%= attribute.column_name %>: <%= attribute.default %> <%- if attribute.polymorphic? -%> - <%= "#{attribute.name}_type: #{attribute.human_name}" %> + <%= yaml_key_value("#{attribute.name}_type", attribute.human_name) %> <%- end -%> <% end -%> +<% end -%> <% else -%> + # This model initially had no columns defined. If you add columns to the # model remove the '{}' from the fixture names and add the columns immediately # below each fixture, per the syntax in the comments below |