Ruby on Rails App Displaying Unwanted Data [duplicate]

左心房为你撑大大i 提交于 2020-02-07 05:26:27

问题


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 %>

The extra output is:

[#<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">]

回答1:


Change

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

to

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


来源:https://stackoverflow.com/questions/6026029/ruby-on-rails-app-displaying-unwanted-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!