Rails 3 newbie here… I’m working to create a devise auth system that like (yammer) has instances where users belong. I have two tables
Users (email, password…)
belongs_to :instance
Instance (domain name, active….)
has_many :users
I added the belongs_to and has_many to the models but the schema hasn’t been updated to add the join, which I believe would be an instance_id column to the User’s table. How does this get accomplished in Rails 3? Thoughts, suggestions?
You have to add these columns to the schema by migrations.
http://guides.rubyonrails.org/migrations.html
Try:
script/rails generate migration AddInstanceToUsers
then go to your db/migrations folder look for the new file and make it look like:
then run
in your console.