问题
I try to add new column into existing model in rubyonrails. How can I add single or multiple field into my existing model.
回答1:
if you want to add a new column then
run rails generator with Add[column]To[model] format followed by column
$ rails g migration AddBioToNameOfModels bio:text
invoke active_record
create db/migrate/YYYYMMDDHHMMSS_add_bio_to_name_of_models.rb
then run
rake db:migrate
来源:https://stackoverflow.com/questions/30528877/rails-4-add-new-column-or-field-in-model