开发者

Ruby on Rails App Displaying Unwanted Data [duplicate]

开发者 https://www.devze.com 2023-03-06 15:07 出处:网络
This question already has answers here: What is the difference between <%, <%=, <%# and -%> in ERB in Rails?
This question already has answers here: What is the difference between <%, <%=, <%# and -%> in ERB in Rails? (7 answers) Closed 3 years ago.

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:

开发者_如何学JAVA
[#<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">]


Change

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

to

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

精彩评论

暂无评论...
验证码 换一张
取 消