On Nov 18, 2011, at 6:13 PM, Eugene Moy wrote: > 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 = "[email protected]" > 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 > :from => e_from, > :subject => e_subject, > :date => e_date, > :time => e_time, > :body => e_body > ) > fevent.save > ---------------------------- > However I am getting this error repeatedly - why is that? > > db/scripts/vbtest.rb:17:in `<main>': uninitialized constant > Object::Foodevent (NameError) > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

