Rails 添加视图有多难?
这是我的错误:
路由错误
未初始化常量OverviewController
我是 Rails 新手,我不知道这意味着什么。我试图创建一个基于 URL 末尾“概述”的视图,有人向我展示了我认为所有内容都带有示例“admin”,这就像一个魅力。
我安装了 Rails 1.9(如果有影响的话)。
我的控制器“overview_controller.rb”位于控制器目录中。它的来源是。
class OverviewController < OverviewController
def index
respond_to do |format|
format.html
end
end
end
我的视图目录中的overview/index.html.erb 其源代码更简单。 “概述占位符”就是这样。
在我的routes.rb中我有 匹配“概述”=> 根据我的理解, “overview#index”
与我得到的“admin”示例的工作方式完全相同。那么为什么这对我的“概述”不起作用
This is my Error:
Routing Error
uninitialized constant OverviewController
Im new to rails I have NO idea what this means. I am trying to create a view based on the end of the URL being "overview", someone showed me I thought everything with an example "admin" and that works like a charm.
I have rails 1.9 installed (if that makes a difference).
I have my controller "overview_controller.rb" in the controllers directory. The source of it being.
class OverviewController < OverviewController
def index
respond_to do |format|
format.html
end
end
end
I have in my views directory overview/index.html.erb its source even simpler. "Overview Place Holder" thats it.
in my routes.rb I have
match "overview" => "overview#index"
this from my understanding is the same exact way the "admin" example I was given works. So why is it this isn't working for me with the "overview"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您试图通过自身对类进行子类化,将控制器的第一行更改为此...
You're trying to subclass the class by it's self, change the first line of your controller to this...