Skip to content

Commit

Permalink
add years to speakers
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin McNally committed Mar 10, 2012
1 parent e8dc4c0 commit d3054cc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/speaker.rb
@@ -0,0 +1,4 @@
class Speaker < ActiveRecord::Base
belongs_to :year
belongs_to :user
end
15 changes: 15 additions & 0 deletions db/migrate/20120310195215_create_speakers.rb
@@ -0,0 +1,15 @@
class CreateSpeakers < ActiveRecord::Migration
def change
create_table :speakers do |t|
t.integer :year_id
t.integer :user_id
t.timestamps
end
User.speaker.each do |spk|
newSpeaker = Speaker.new()
newSpeaker.user_id = spk.id
newSpeaker.year_id = 2011
newSpeaker.save
end
end
end
8 changes: 8 additions & 0 deletions spec/factories/speakers.rb
@@ -0,0 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl

FactoryGirl.define do
factory :speaker do
year_id 1
user_id 1
end
end
5 changes: 5 additions & 0 deletions spec/models/speaker_spec.rb
@@ -0,0 +1,5 @@
require 'spec_helper'

describe Speaker do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit d3054cc

Please sign in to comment.