ROR 博客示例应用程序中缺少“添加评论”选项

发布于 2024-12-19 18:36:34 字数 426 浏览 2 评论 0原文

ROR 示例应用程序 URL - http://sixrevisions.com/web-development/how-to-create-a-blog-from-scratch-using-ruby-on-rails/

我尝试了上面的参考来使用 Ruby 创建博客应用程序在导轨。 除了帖子显示页面中的“添加评论”选项外,一切正常。

根据参考 URL,“添加评论”将出现在显示页面本身中。但在我的本地浏览器中我看不到它。

注意:我使用 Rails 3.1.3 和 PostgreSQL 9.0.5 后端

ROR Sample Application URL - http://sixrevisions.com/web-development/how-to-create-a-blog-from-scratch-using-ruby-on-rails/

I tried above reference for creating a blog application using Ruby on Rails.
Everything is working fine except the option "Add Comment" in show page of a Post.

As per the reference URL "Add Comment" will be there in Show page itself. But in my local browser I am not able to see it.

Note : I am using Rails 3.1.3 with back end of PostgreSQL 9.0.5

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

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

发布评论

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

评论(3

睫毛上残留的泪 2024-12-26 18:36:34

本教程基于 RoR 2。您使用的是 Rails 3.1.3,这意味着本教程不起作用。

根据建议,我会使用官方指南: http://guides.rubyonrails.org/getting_started.html< /a>

This tutorial is based on RoR 2. You are using Rails 3.1.3, which means that this tutorial won't work.

As suggested, I would go with the official guide : http://guides.rubyonrails.org/getting_started.html

请你别敷衍 2024-12-26 18:36:34

您可能错过了代码中的某些内容(显然,我知道),我建议回滚到没有注释的工作模型,并遵循那里的指南。

本指南是示例博客指南的副本,位于 http://guides.rubyonrails.org/getting_started.html 所以我建议遵循官方指南,因为它可能会更详细地解释并涵盖基于社区反馈的主题。我发现这些指南是网络上最新的 Rails 资源。

You have probably missed something in the code (obvious, I know), I would suggest rolling back to a working model without comments and following the guide from there.

This guide is a copy of the sample blog guide found at http://guides.rubyonrails.org/getting_started.html so I would suggest following the official guide as it probably explains in more detail and covers topics based on community feedback. I have found these guides to be the most up-to-date resource for rails on the web.

情话已封尘 2024-12-26 18:36:34

Rails 3.0 改变了 ERB 标签 (<%) 的解释方式。您现在需要对任何捕获输出的块使用 <%=。如果您在 3.0.x 中运行此程序,您会看到弃用警告,但 3.1.x 假定您已经进行了更改并默默地失败。

<% form_for [@post, Comment.new] do |f| %> 

会变成:

<%= form_for [@post, Comment.new] do |f| %>

Rails 3.0 changed how ERB tags (<%) are interpreted. You now need to use <%= with any blocks that are capturing output. If you were running this in 3.0.x, you would see deprecation warnings, but 3.1.x assumes you have already made the changes and silently fails.

<% form_for [@post, Comment.new] do |f| %> 

would become:

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