From 2f6004de6e692da81237a4d978b273acfbc9f396 Mon Sep 17 00:00:00 2001
From: Robin Dupret <robin.dupret@gmail.com>
Date: Wed, 4 Jul 2012 17:26:19 +0300
Subject: Add few information on the field types

---
 railties/lib/rails/generators/rails/model/USAGE | 49 +++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/rails/generators/rails/model/USAGE
index 67f76aad01..c46c86076e 100644
--- a/railties/lib/rails/generators/rails/model/USAGE
+++ b/railties/lib/rails/generators/rails/model/USAGE
@@ -19,6 +19,55 @@ Description:
     then the generator will create a module with a table_name_prefix method
     to prefix the model's table name with the module name (e.g. admin_account)
 
+Available field types:
+
+    Just after the field name you can specify a type like text or boolean. 
+    It will generate the column with the associated SQL type. For instance:
+
+        `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:
+
+        integer
+        primary_key
+        decimal
+        float
+        boolean
+        binary
+        string
+        text
+        date
+        time
+        datetime
+        timestamp
+
+    You can also consider `references` as a kind of type. For instance, if you run:
+
+        `rails generate model photo title:string album:references`
+
+    It will generate an album_id column. You should generate this kind of fields when
+    you will use a `belongs_to` association for instance. `references` also support
+    the polymorphism, you could enable the polymorphism like this:
+
+        `rails generate model product supplier:references{polymorphic}`
+
+    You can also specify some options just after the field type. You can use the
+    following options:
+
+        limit        Set the maximum size of the field giving a number between curly braces
+        default      Set a default value for the field
+        precision    Defines the precision for the decimal fields 
+        scale        Defines the scale for the decimal fields
+        uniq         Defines the field values as unique 
+        index        Will add an index on the field
+
+    Examples:
+
+        `rails generate model user pseudo:string{30}`
+        `rails generate model user pseudo:string:uniq`
+        
+
 Examples:
     `rails generate model account`
 
-- 
cgit v1.2.3