I'm a bit confused as to how to map this migration.
I have two models: user and ticket
class User < ActiveRecord::Base
has_many :tickets
end
class Ticket < ActiveRecord::Base
has_many :users
end
I believe a ticket should be has_many users because a ticket itself has a creator (which is a user object) and it has an assigned_user (which is also a user object)
class CreateTickets < ActiveRecord::Migration
def change
create_table :tickets do |t|
t.string :status
t.boolean :complete, :default => false
t.integer :assigned_user
t.datetime :deadline
t.string :description
t.integer :owner
t.string :story_type, :default => "Bug"
t.integer :points, :default => 0
t.timestamps null: false
end
end
end
I put them as integer fields to map the user ID, but I believe that's way off. Is there a better way to do this?