A small question about rails console. I am using Ruby 2.6.0, Rails 5.2.3. I created a countries table and a users table.
I use has_and_belongs_to_many :users in the Country model and has_and_belongs_to_many :countries in the User model. I also created country_users table following the guide. I want to make multiple values for country_id in users table. I think it is about adding array into one column.
I already have two records in users table. I want to know how can I use rails c to add more values to country_id column in users table.
Example:
Two records I had in users table:
<User id: 1, email: "[email protected]", created_at: "2019-05-21 12:36:08", updated_at: "2019-05-21 12:49:08",countryid: 1, regionid: 1>
<User id: 2, email: "[email protected]", created_at: "2019-05-21 12:36:18", updated_at: "2019-05-21 12:49:28",countryid: 2, regionid: 2>
How to add '2' into country_id column for first user via console?