diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-25 13:39:59 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-25 13:39:59 -0300 |
commit | 48cd7d337d7b2848e16cd38cc50f04fc04d85ff4 (patch) | |
tree | b81ecf9c6560bd44cccda3a21209175b1650f5c9 /railties/lib | |
parent | 6d87b78ab330b8d2e6f77215b303c779e2e98006 (diff) | |
parent | 31d37826b3f5f2ce2643d5d311e5f82b4995bbe9 (diff) | |
download | rails-48cd7d337d7b2848e16cd38cc50f04fc04d85ff4.tar.gz rails-48cd7d337d7b2848e16cd38cc50f04fc04d85ff4.tar.bz2 rails-48cd7d337d7b2848e16cd38cc50f04fc04d85ff4.zip |
Merge pull request #16285 from noinkling/password_digest_docs
Add password:digest information to scaffold generator help text
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/model/USAGE | 12 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold/USAGE | 8 |
2 files changed, 18 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/rails/generators/rails/model/USAGE index 833b7beb7f..2a6b8700e3 100644 --- a/railties/lib/rails/generators/rails/model/USAGE +++ b/railties/lib/rails/generators/rails/model/USAGE @@ -6,6 +6,11 @@ Description: model's attributes. Timestamps are added by default, so you don't have to specify them by hand as 'created_at:datetime updated_at:datetime'. + As a special case, specifying 'password:digest' will generate a + password_digest field of string type, and configure your generated model and + tests for use with ActiveModel has_secure_password (assuming the default ORM + and test framework are being used). + You don't have to think up every attribute up front, but it helps to sketch out a few so you can start working with the model immediately. @@ -27,7 +32,8 @@ Available field types: `rails generate model post title:string body:text` will generate a title column with a varchar type and a body column with a text - type. You can use the following types: + type. If no type is specified the string type will be used by default. + You can use the following types: integer primary_key @@ -73,6 +79,10 @@ Available field types: `rails generate model user username:string{30}:uniq` `rails generate model product supplier:references{polymorphic}:index` + If you require a `password_digest` string column for use with + has_secure_password, you should specify `password:digest`: + + `rails generate model user password:digest` Examples: `rails generate model account` diff --git a/railties/lib/rails/generators/rails/scaffold/USAGE b/railties/lib/rails/generators/rails/scaffold/USAGE index 4a3eb2c7c7..1b2a944103 100644 --- a/railties/lib/rails/generators/rails/scaffold/USAGE +++ b/railties/lib/rails/generators/rails/scaffold/USAGE @@ -9,11 +9,16 @@ Description: Attributes are field arguments specifying the model's attributes. You can optionally pass the type and an index to each field. For instance: - "title body:text tracking_id:integer:uniq" will generate a title field of + 'title body:text tracking_id:integer:uniq' will generate a title field of string type, a body with text type and a tracking_id as an integer with an unique index. "index" could also be given instead of "uniq" if one desires a non unique index. + As a special case, specifying 'password:digest' will generate a + password_digest field of string type, and configure your generated model, + controller, views, and test suite for use with ActiveModel + has_secure_password (assuming they are using Rails defaults). + Timestamps are added by default, so you don't have to specify them by hand as 'created_at:datetime updated_at:datetime'. @@ -33,3 +38,4 @@ Examples: `rails generate scaffold post` `rails generate scaffold post title body:text published:boolean` `rails generate scaffold purchase amount:decimal tracking_id:integer:uniq` + `rails generate scaffold user email:uniq password:digest` |