aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
diff options
context:
space:
mode:
authorSam Ruby <rubys@intertwingly.net>2013-03-13 08:08:56 -0400
committerSam Ruby <rubys@intertwingly.net>2013-03-13 16:06:33 -0400
commit3008994d1e29b7e59a64bf0a03b5408a2946db25 (patch)
tree34195fc32c9188a17820c3ba4833ba26053ab353 /railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
parentcd9f7508df9485ea7ec66d0172c1d6bcfe7ed5a8 (diff)
downloadrails-3008994d1e29b7e59a64bf0a03b5408a2946db25.tar.gz
rails-3008994d1e29b7e59a64bf0a03b5408a2946db25.tar.bz2
rails-3008994d1e29b7e59a64bf0a03b5408a2946db25.zip
Add support for generate scaffold password:digest
* adds password_digest attribute to the migration * adds has_secure_password to the model * adds password and password_confirmation password_fields to _form.html * omits password entirely from index.html and show.html * adds password and password_confirmation to the controller * adds unencrypted password and password_confirmation to the controller test * adds encrypted password_digest to the fixture
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.yml16
1 files changed, 7 insertions, 9 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 c9d505c84a..90a92e6982 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
-
<% unless attributes.empty? -%>
-one:
+<% %w(one two).each do |name| %>
+<%= name %>:
<% attributes.each do |attribute| -%>
+ <%- if attribute.password_digest? -%>
+ password_digest: <%%= BCrypt::Password.create('secret') %>
+ <%- else -%>
<%= yaml_key_value(attribute.column_name, attribute.default) %>
- <%- if attribute.polymorphic? -%>
- <%= yaml_key_value("#{attribute.name}_type", attribute.human_name) %>
<%- end -%>
-<% end -%>
-
-two:
-<% attributes.each do |attribute| -%>
- <%= yaml_key_value(attribute.column_name, attribute.default) %>
<%- if attribute.polymorphic? -%>
<%= 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