uninitialized constant Object::Foodevent (NameError)

I have a model named Foodevent which I am trying to use to insert objects into my database. This is my code

I have a model named Foodevent which I am trying to use to insert objects into my database. This is my code ---------------------------- require 'rubygems'

e_from = "john.doe@hotmail.com" e_subject = "first post" e_date = "2011-12-03" e_time = "18:00" e_body = "testing testing"

fevent = Foodevent.new(

At this point, have you already declared or required the Foodevent class? From the sounds of that error, I think maybe it isn't there yet.

Walter

I think I did? I ran

rails generate scaffold Foodevent from:string subject:string date:string time:string body:text

and

rake db:migrate

before running the script.

Walter Davis wrote in post #1032619:

Ok - I'm really stupid. Was trying to run it using `ruby` instead of `rails runner`.

Not at all. Rails does so much magic most of the time, you don't realize you don't have it until it doesn't happen.

Walter