diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-04-11 09:27:45 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-12 10:57:27 +0200 |
commit | 788d9238931bb36ed2af78d34c84562dc3a4848c (patch) | |
tree | d3ce4f2535226bcbb273b0cc024b60b2d12beea8 /railties/lib/rails | |
parent | b9b9f9ee15e2282e9c765d86cb8b6120e2bdb1b9 (diff) | |
download | rails-788d9238931bb36ed2af78d34c84562dc3a4848c.tar.gz rails-788d9238931bb36ed2af78d34c84562dc3a4848c.tar.bz2 rails-788d9238931bb36ed2af78d34c84562dc3a4848c.zip |
Generate module file for namespaced models [#4230 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/model/USAGE | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/rails/generators/rails/model/USAGE index d97e9ac103..db98a2dd1b 100644 --- a/railties/lib/rails/generators/rails/model/USAGE +++ b/railties/lib/rails/generators/rails/model/USAGE @@ -15,6 +15,10 @@ Description: Finally, if --parent option is given, it's used as superclass of the created model. This allows you create Single Table Inheritance models. + If you pass a namespaced model name (e.g. admin/account or Admin::Account) + 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) + Examples: `rails generate model account` @@ -28,3 +32,14 @@ Examples: `rails generate model post title:string body:text published:boolean` Creates a Post model with a string title, text body, and published flag. + + `rails generate model admin/account` + + For ActiveRecord and TestUnit it creates: + + Module: app/models/admin.rb + Model: app/models/admin/account.rb + Test: test/unit/admin/account_test.rb + Fixtures: test/fixtures/admin_accounts.yml + Migration: db/migrate/XXX_add_admin_accounts.rb + |