I have the following models:
User (id, name, network_id)
Network(id, title)
What kind of Rails model assoc do I need to add so that I can do:>
This is my way: run:
$rails generate migration AddNetworkIdToUsers
then config migration file:
class AddNetworkIdToUsers < ActiveRecord::Migration[5.1]
def up
add_column :users, :network_id, :integer
add_index :users, :network_id
end
def down
remove_index :users, :network_id
remove_column :users, :network_id
end
end