diff options
author | Sam Ruby <rubys@intertwingly.net> | 2013-03-13 08:08:56 -0400 |
---|---|---|
committer | Sam Ruby <rubys@intertwingly.net> | 2013-03-13 16:06:33 -0400 |
commit | 3008994d1e29b7e59a64bf0a03b5408a2946db25 (patch) | |
tree | 34195fc32c9188a17820c3ba4833ba26053ab353 /railties/lib/rails/generators/test_unit/scaffold | |
parent | cd9f7508df9485ea7ec66d0172c1d6bcfe7ed5a8 (diff) | |
download | rails-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/scaffold')
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb index 8f3ecaadea..2e1f55f2a6 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb @@ -21,7 +21,11 @@ module TestUnit # :nodoc: return if attributes_names.empty? attributes_names.map do |name| - "#{name}: @#{singular_table_name}.#{name}" + if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?) + "#{name}: 'secret'" + else + "#{name}: @#{singular_table_name}.#{name}" + end end.sort.join(', ') end end |