Passing additional parameters to Rails Generate Model?

后端 未结 4 2058
余生分开走
余生分开走 2021-02-08 01:38

I\'m new to Ruby and Rails and I\'m running Rails 3 on Ruby 1.9.2.

I want to create a model, so I looked at the documentation to get the table definition that I want, bu

4条回答
  •  不思量自难忘°
    2021-02-08 02:12

    Yes you do have to manually edit the migration file for that. The generator just offers a starting point, it does not do everything.

    Doing this in the migration file is very easy anyway.

    create_table :articles do |t|
      t.string :title, :null => false
      t.text   :details, :limit => 3000, :null => false
    end
    

提交回复
热议问题