Search code examples
ruby-on-railsdocumentationrails-migrationsrails-generate

How to get documentation from Rails generators about type modifiers


In the documentation for Active Record Migrations in Rails 4.2.x, the section 2.3 Passing Modifiers says:

Some commonly used type modifiers can be passed directly on the command line. They are enclosed by curly braces and follow the field type:

For instance, running:

$ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplier:references{polymorphic}

...

Have a look at the generators help output for further details.

However, running bundle exec rails generate migration --help in Rails 4.2.x (in my case 4.2.3) doesn't mention anything about passing type modifiers - I can't even see a single curly brace.

I can see some documentation at 3.5 Column Modifiers, but how do I get the documentation referred to as being from the "generators help output"?


Solution

  • To get the inline help describing types modifiers you need to run

    bundle exec rails generate model --help
    

    Also, the help text is coming from here: https://github.com/randoum/rails/blob/master/railties/lib/rails/generators/rails/model/USAGE