Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1. [root@mayureshmayur test_scaffold]# rails g scaffold
  2. Running via Spring preloader in process 2715
  3. Usage:
  4. rails generate scaffold NAME [field[:type][:index] field[:type][:index]] [options]
  5.  
  6. Options:
  7. [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
  8. [--force-plural], [--no-force-plural] # Forces the use of the given model name
  9. -o, --orm=NAME # ORM to be invoked
  10. # Default: active_record
  11. [--model-name=MODEL_NAME] # ModelName to be used
  12. [--resource-route], [--no-resource-route] # Indicates when to generate resource route
  13. # Default: true
  14. [--api], [--no-api] # Indicates when to generate api
  15. -y, [--stylesheets], [--no-stylesheets] # Generate Stylesheets
  16. # Default: true
  17. -se, [--stylesheet-engine=STYLESHEET_ENGINE] # Engine for Stylesheets
  18. # Default: scss
  19. [--assets], [--no-assets] # Indicates when to generate assets
  20. # Default: true
  21. -ss, [--scaffold-stylesheet], [--no-scaffold-stylesheet] # Indicates when to generate scaffold stylesheet
  22. # Default: true
  23. -c, --scaffold-controller=NAME # Scaffold controller to be invoked
  24. # Default: scaffold_controller
  25.  
  26. ActiveRecord options:
  27. [--migration], [--no-migration] # Indicates when to generate migration
  28. # Default: true
  29. [--timestamps], [--no-timestamps] # Indicates when to generate timestamps
  30. # Default: true
  31. [--parent=PARENT] # The parent class for the generated model
  32. [--indexes], [--no-indexes] # Add indexes for references and belongs_to columns
  33. # Default: true
  34. [--primary-key-type=PRIMARY_KEY_TYPE] # The type for primary key
  35. -t, [--test-framework=NAME] # Test framework to be invoked
  36. # Default: test_unit
  37.  
  38. TestUnit options:
  39. [--fixture], [--no-fixture] # Indicates when to generate fixture
  40. # Default: true
  41. -r, [--fixture-replacement=NAME] # Fixture replacement to be invoked
  42. [--system-tests=SYSTEM_TESTS] # Skip system test files
  43. # Default: test_unit
  44.  
  45. ScaffoldController options:
  46. [--helper], [--no-helper] # Indicates when to generate helper
  47. # Default: true
  48. -e, [--template-engine=NAME] # Template engine to be invoked
  49. # Default: erb
  50. [--jbuilder], [--no-jbuilder] # Indicates when to generate jbuilder
  51. # Default: true
  52.  
  53. Asset options:
  54. -j, [--javascripts], [--no-javascripts] # Generate JavaScripts
  55. # Default: true
  56. -je, [--javascript-engine=JAVASCRIPT_ENGINE] # Engine for JavaScripts
  57. # Default: coffee
  58.  
  59. Runtime options:
  60. -f, [--force] # Overwrite files that already exist
  61. -p, [--pretend], [--no-pretend] # Run but do not make any changes
  62. -q, [--quiet], [--no-quiet] # Suppress status output
  63. -s, [--skip], [--no-skip] # Skip files that already exist
  64.  
  65. Description:
  66. Scaffolds an entire resource, from model and migration to controller and
  67. views, along with a full test suite. The resource is ready to use as a
  68. starting point for your RESTful, resource-oriented application.
  69.  
  70. Pass the name of the model (in singular form), either CamelCased or
  71. under_scored, as the first argument, and an optional list of attribute
  72. pairs.
  73.  
  74. Attributes are field arguments specifying the model's attributes. You can
  75. optionally pass the type and an index to each field. For instance:
  76. 'title body:text tracking_id:integer:uniq' will generate a title field of
  77. string type, a body with text type and a tracking_id as an integer with an
  78. unique index. "index" could also be given instead of "uniq" if one desires
  79. a non unique index.
  80.  
  81. As a special case, specifying 'password:digest' will generate a
  82. password_digest field of string type, and configure your generated model,
  83. controller, views, and test suite for use with Active Model
  84. has_secure_password (assuming they are using Rails defaults).
  85.  
  86. Timestamps are added by default, so you don't have to specify them by hand
  87. as 'created_at:datetime updated_at:datetime'.
  88.  
  89. You don't have to think up every attribute up front, but it helps to
  90. sketch out a few so you can start working with the resource immediately.
  91.  
  92. For example, 'scaffold post title body:text published:boolean' gives
  93. you a model with those three attributes, a controller that handles
  94. the create/show/update/destroy, forms to create and edit your posts, and
  95. an index that lists them all, as well as a resources :posts declaration
  96. in config/routes.rb.
  97.  
  98. If you want to remove all the generated files, run
  99. 'rails destroy scaffold ModelName'.
  100.  
  101. Examples:
  102. `rails generate scaffold post`
  103. `rails generate scaffold post title:string body:text published:boolean`
  104. `rails generate scaffold purchase amount:decimal tracking_id:integer:uniq`
  105. `rails generate scaffold user email:uniq password:digest`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement