Rails脚手架[控制器]#new崩溃服务器
Rails Scaffolding [controller]#new crashing server
继续我的 Rails 图书馆管理应用程序,我了解了脚手架,并认为它会给我足够的框架来重新工作。问题是,尽管正在生成脚手架和所有内容,但它们无法正常工作。相反,它们根本不起作用。
当我访问http://localhost/[controller-name], It shoots up a webpage that says Listing [controller-name] all fine. But when i click on new button or navigate to http://localhost/[controller-name]/new时,服务器没有报错就崩溃了。
P.S.
在尝试的过程中,我注意到虽然,
$ rails generate scaffold person name:string identity:integer DOB:date
工作正常,
$ rails generate scaffold student name:string id_number:integer class:integer section:string issued:date returned:date fine:integer reissued:date
不是吗?
P.P.S.
真正的问题是,访问操作 "student#new" 不仅 NOT 工作,而且还会使我的服务器崩溃(是的,没有退出 WEBrick)。我只能提供最后出现的消息:
Started GET "/assets/students.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/students/new" for 127.0.0.1 at 2015-08-05 12:20:21 +0530
Processing by StudentsController#new as HTML
class
是 Ruby 中的关键字,因此将其用作列名并不是一个好主意。在这一行:
$ rails generate scaffold student name:string id_number:integer class:integer section:string issued:date returned:date fine:integer reissued:date
将 class:integer
更改为 kind:integer
应该可以。
继续我的 Rails 图书馆管理应用程序,我了解了脚手架,并认为它会给我足够的框架来重新工作。问题是,尽管正在生成脚手架和所有内容,但它们无法正常工作。相反,它们根本不起作用。
当我访问http://localhost/[controller-name], It shoots up a webpage that says Listing [controller-name] all fine. But when i click on new button or navigate to http://localhost/[controller-name]/new时,服务器没有报错就崩溃了。
P.S.
在尝试的过程中,我注意到虽然,
$ rails generate scaffold person name:string identity:integer DOB:date
工作正常,
$ rails generate scaffold student name:string id_number:integer class:integer section:string issued:date returned:date fine:integer reissued:date
不是吗?
P.P.S.
真正的问题是,访问操作 "student#new" 不仅 NOT 工作,而且还会使我的服务器崩溃(是的,没有退出 WEBrick)。我只能提供最后出现的消息:
Started GET "/assets/students.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2015-08-05 12:20:19 +0530
Started GET "/students/new" for 127.0.0.1 at 2015-08-05 12:20:21 +0530
Processing by StudentsController#new as HTML
class
是 Ruby 中的关键字,因此将其用作列名并不是一个好主意。在这一行:
$ rails generate scaffold student name:string id_number:integer class:integer section:string issued:date returned:date fine:integer reissued:date
将 class:integer
更改为 kind:integer
应该可以。