Ruby on Rails应用程序显示不需要的数据 [英] Ruby on Rails App Displaying Unwanted Data

查看:126
本文介绍了Ruby on Rails应用程序显示不需要的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论何时运行以下代码,我都会在页面上获得额外的输出,就像底部的垃圾一样.我试图查看它是否在我的迁移或函数调用中,但它们似乎都非常干净(f.name不太多).如果需要,我可以提供我的迁移和架构的副本.

Whenever the following code runs i get extra output on the page which looks like the garbage on the bottom. I have tried to see if it is in my migrations or function calls, but they all seem to be pretty clean (not much too f.name). If needed I can provide a copy of my migrations and schema.

<%= @subject.Name %>
<%= @subject.formulas.each do |f| %>
  <div class="entry">
    <h3><%= f.name %></h3>  
  </div>
<% end %>

额外的输出是:

[#<Formula id: 2, name: "Pythagorean Theorem", description: "n any right triangle, the area of the square whose ...", formula: "a^2+b^2=c^2", created_at: "2011-05-17 03:18:44", updated_at: "2011-05-17 03:18:44">]

推荐答案

更改

<%= @subject.formulas.each do |f| %>

<% @subject.formulas.each do |f| %>

这篇关于Ruby on Rails应用程序显示不需要的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆