Mysql 在rails中创建新对象时出错

Mysql 在rails中创建新对象时出错,mysql,ruby-on-rails,object,syntax-error,Mysql,Ruby On Rails,Object,Syntax Error,每当我尝试为模型创建对象时,rails中就会出现这个错误。我在Windows7上工作 C:\Ruby\joker\chapter3>ruby script/console Loading development environment (Rails 2.3.8) >> mycb = ComicBook.new SyntaxError: C:/Ruby/joker/chapter3/app/models/comic_book.rb:19: syntax error, u nexp

每当我尝试为模型创建对象时,rails中就会出现这个错误。我在Windows7上工作

C:\Ruby\joker\chapter3>ruby script/console
Loading development environment (Rails 2.3.8)
>> mycb = ComicBook.new
SyntaxError: C:/Ruby/joker/chapter3/app/models/comic_book.rb:19: syntax error, u
nexpected $end, expecting kEND
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:380:in `load_without_new_constant_marking'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:380:in `load_file'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:521:in `new_constants_in'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:379:in `load_file'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:259:in `require_or_load'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:425:in `load_missing_constant'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:80:in `const_missing'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_suppo
rt/dependencies.rb:92:in `const_missing'
        from (irb):1
>>
我还附上了图片,以便您可以看到模型本身

此外,我附上您创建的模型漫画书

 C:\Ruby\joker\chapter3>ruby script/generate model ComicBook
      exists  app/models/
      exists  test/unit/
      exists  test/fixtures/
      create  app/models/comic_book.rb
      create  test/unit/comic_book_test.rb
      create  test/fixtures/comic_books.yml
      create  db/migrate
      create  db/migrate/20100923101842_create_comic_books.rb
我工作的环境很好

Ruby version    1.8.7 (i386-mingw32)
RubyGems version    1.3.7
Rack version    1.1
Rails version   2.3.8
Active Record version   2.3.8
Active Resource version 2.3.8
Action Mailer version   2.3.8
Active Support version  2.3.8
Application root    C:/Ruby/joker/chapter3
Environment development
Database adapter    mysql
Database schema version 20100923101842
期待您的帮助


谢谢

迁移中必须有方法
self.up
self.down
(db/migrate/20100923101842\u create\u comic\u books.rb)

CookBook模型的Clean类必须如下所示:

class CookBook < ActiveRedord::Base
end
class食谱
代码中缺少最后一个“end”(models/comic_book.rb)