How does one add an attribute to a model?

后端 未结 4 669
余生分开走
余生分开走 2020-12-07 19:05

In rails I generate a model with two strings and would like to add more. How would I go about doing this?

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 19:20

    If you are using the Rails 4.x you can now generate migrations with references, like this:

    rails generate migration AddUserRefToProducts user:references

    like you can see on rails guides

提交回复
热议问题