Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List available generators in rails application

Tags:

How to get a list of available generators in a Rails application, including those from included gems like devise? (Similar to rake -T for a list of rake tasks)

like image 985
Santhosh Avatar asked Sep 02 '13 07:09

Santhosh


People also ask

What are rails generators?

Rails Generate --no-test-framework is a flag that tells the generator not to create any tests for the newly-generated models, controllers, etc. When you're working on your own Rails applications, you don't need the flag — it's quite helpful for quickly stubbing out a test suite.

Does Ruby have generators?

Ruby provides a script called Generator. This script can be used to generate many useful items in Rails.

How do you generate scaffold in rails?

To generate a fully working scaffold for a new object, including model, controller, views, assets, and tests, use the rails g scaffold command. Then you can run rake db:migrate to set up the database table. Then you can visit http://localhost:3000/widgets and you'll see a fully functional CRUD scaffold.

What are templates in Rails?

Application templates are simple Ruby files containing DSL for adding gems, initializers, etc. to your freshly created Rails project or an existing Rails project. After reading this guide, you will know: How to use templates to generate/customize Rails applications.


1 Answers

I got it. The command is

rails generate 

Output is like this:

Usage: rails generate GENERATOR [args] [options] General options:   -h, [--help]     # Print generator's options and usage   -p, [--pretend]  # Run but do not make any changes   -f, [--force]    # Overwrite files that already exist   -s, [--skip]     # Skip files that already exist   -q, [--quiet]    # Suppress status output  Please choose a generator below.  Rails:   assets   controller   generator   helper   inherited_resources_controller   integration_test   mailer   migration   model   observer   performance_test   resource   responders_controller   scaffold   scaffold_controller   session_migration   task  ActiveRecord:   active_record:devise   active_record:migration   active_record:model   active_record:observer   active_record:session_migration  Coffee:   coffee:assets  Devise:   devise   devise:install   devise:views 
like image 157
Santhosh Avatar answered Sep 30 '22 02:09

Santhosh