Syntax to specify limit while generating a model

activerecord, ruby-on-rails, ruby-on-rails-3

Solution

You can provide the limit with braces:

rails g model Session session_id:string{40} user_agent:string{200}

Problem

in rails, we can generate the model like this ``` rails generate model post title:string body:text published:boolean ``` And the command has following syntax as per the rails guide ``` $ rails generate model Usage: rails generate model NAME [field:type field:type] [options] ``` I am wondering if its possible to specify limit/length for each field as part of `[options]`? Further, what is the use of `[options]` parameter?

Original source