For some reason, the food_id field in 'ratings' isn't populating when I run the seed.rb file below. Can somebody help me figure out why?
Seed file contains the following lines:
Food.create(:id => 1, :description => 'Stonyfield Farm Yomommy 4oz. Strawberry')
OverallRating.create(:score => 0, :count => 1, :food_id => 1)
Code for Food and Rating are as follows: class OverallRating < Rating belongs_to :food end
class Food < ActiveRecord::Base
has_one :overall_rating
end
class Rating < ActiveRecord::Base
belongs_to :food
end
The rating migration file is as follows:
class CreateRatings < ActiveRecord::Migration
def self.up
create_table :ratings do |t|
t.integer :food_id
t.integer :count
t.decimal :score
t.string :type
t.timestamps
end
end
def self.down
drop_table :ratings
end
end