Ruby on Rails 新手:如何获得合适的错误报告?

发布于 2024-10-08 10:52:23 字数 748 浏览 1 评论 0原文

所以今天我第一次使用 RoR 来使用《Rails for PHP Developers》一书。我正在按照那里的教程进行操作。

我创建了一个项目,其中包含模型 Subscriber 和控制器 Subscribers,其中包含方法 create。然后我运行 ruby​​ script/server 来启动 Mongrel。

现在,这本书说,如果我去 http://localhost:3000/subscribers/create 我应该收到错误,因为还没有与此操作关联的模板。书中显示了此错误消息:

模板缺失
视图路径 /Users/derek/work/newsletter/app/views 中缺少模板subscribes/create.html.erb

一条很好的描述性错误消息,非常有帮助。但我得到的错误是:

很抱歉,出了点问题。
我们已收到有关此问题的通知,我们将尽快予以处理。

该错误根本没有帮助。我怀疑这与本书使用 WEBrick 而我使用 Mongrel 有关。但我认为应该可能会出现更多描述性错误,对吧?带着这样的错误进行开发似乎相当痛苦。

So today I've been working with RoR for the first time using the book 'Rails for PHP developers'. I'm following the tutorial in there.

I created a project, with a model Subscriber and a controller Subscribers, which has a method create. Then I ran ruby script/server to launch Mongrel.

Now, the book says that if I go to http://localhost:3000/subscribers/create I should get an error because there's no template associated (yet) for this action. The book shows this error message:

Template missing
Missing template subscribers/create.html.erb in view path /Users/derek/work/newsletter/app/views

A nice descriptive error message, really helpful. But the error I get is:

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

That error is not helpful at all. I suspect it has to do with the fact that the book uses WEBrick, and I use Mongrel. But I assume it should be possible to get more descriptive errors, right? It seems quite painful to develop with errors like this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

給妳壹絲溫柔 2024-10-15 10:52:23

看起来您的某些 Rails 安装是半瘫痪的。您可能缺少 mysql gem,或者可能没有正确配置 mysql ActiveRecord 适配器。

使用 gem list 查看已安装的 gems

$ sudo gem list

您可以使用 gem install 命令来安装或更新 gems

$ sudo gem install rails mysql

您通常希望使用 sudo (作为 root)安装 gems,以便所有用户都可以使用它们(例如 apache 或 www-data)

抱歉您第一次尝试 Rails 并不顺利,相信我,它是一个非常强大的框架。坚持下去!

It looks like some of your Rails install is semi borked. You might be missing the mysql gem or might not have the mysql ActiveRecord adaptor configured correctly.

Use gem list to see the gems you have installed

$ sudo gem list

you can use the gem install command to install or update gems

$ sudo gem install rails mysql

You usually want to install gems with sudo (as root) so all users can use them ( like apache or www-data)

Im sorry your first try at Rails hasn't gone smoothly, trust me it is an extremely powerful framework. Strick with it!

水溶 2024-10-15 10:52:23

您可能忘记设置数据库。您可以查看 log/development.log 了解更多详细信息。

You probably forgot to setup the database. You can check log/development.log for further details.

魂ガ小子 2024-10-15 10:52:23

如果您在开发模式下运行,您只会收到第一条消息。

you only get the first message if you are running in development mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文