How do you add a column to a table using ActiveRecord through the terminal. I am trying to use add_column method but its not working. Any ideas please?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is better to write a migration and a must if you are working with a team. When you make db changes, then every developer’s environment has to be updated also. Otherwise, you will have some mad developers at you.
will generate
Then you run the migration
http://guides.rubyonrails.org/migrations.html
Edit:
For a rails console command line check @tadman’s answer or use what Bengala proposed like