How does one add an attribute to a model?
问题 In rails I generate a model with two strings and would like to add more. How would I go about doing this? 回答1: Active Record maps your tables columns to attributes in your model, so you don't need to tell rails that you need more, what you have to do is create more columns and rails is going to detect them, the attributes will be added automatically. You can add more columns to your table through migrations: rails generate migration AddNewColumnToMyTable column_name:column_type(string by