diff options
author | robertomiranda <rjmaltamar@gmail.com> | 2015-01-11 14:06:41 -0500 |
---|---|---|
committer | robertomiranda <rjmaltamar@gmail.com> | 2015-01-11 14:42:54 -0500 |
commit | 5cca205114280bcbf9b43134ff396f1ac47b5071 (patch) | |
tree | fc8ca672212b1e6570ce49edd7258bd77890595d /activerecord/lib/rails/generators/active_record/model/templates | |
parent | 7b47f422cf367db4918be76c417d9db592a04adf (diff) | |
download | rails-5cca205114280bcbf9b43134ff396f1ac47b5071.tar.gz rails-5cca205114280bcbf9b43134ff396f1ac47b5071.tar.bz2 rails-5cca205114280bcbf9b43134ff396f1ac47b5071.zip |
Add Secure Token Generator
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/model/templates')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/templates/model.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/rails/generators/active_record/model/templates/model.rb b/activerecord/lib/rails/generators/active_record/model/templates/model.rb index 539d969fce..55dc65c8ad 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/model.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/model.rb @@ -3,6 +3,9 @@ class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %> <% end -%> +<% attributes.select(&:token?).each do |attribute| -%> + has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %> +<% end -%> <% if attributes.any?(&:password_digest?) -%> has_secure_password <% end -%> |