Topic: Var dump at the bottom of a page?

i am working with rails 3 i have the following model

class ContactController < ApplicationController  def index    @surveys = Survey.active  endend

my controller

class ContactController < ApplicationController  def index    @surveys = Survey.active  endend

and my view

<%= @surveys.each do |p| %>  <li><%=p.id %>-<%=p.name %></li><%end%>

my anticipated outcome is that it for each through the surveys variable outputting the id and name in a li. which it does however it also dumps the variable out at the bottom of the page.

1-Ben Hill Voter ID
[#<Survey id: 1, name: "Ben Hill Voter ID", is_active: true, user_id: nil, open_script: "Opening Script", voicemail_script: "Voice Mail Script", closing_script: "Closing Script", email_script: "Email Script", created_at: "2012-12-19 15:17:36", updated_at: "2012-12-20 03:46:35">]

Re: Var dump at the bottom of a page?

Remove the "=" symbol from your for statement

<%= @surveys.each do |p| %>  
  <li><%=p.id %>-
    <%=p.name %>
  </li>
<%end%>

Should be

<% @surveys.each do |p| %>  
  <li><%=p.id %>-
    <%=p.name %>
  </li>
<%end%>

The = sign in an opening erb tag indicates that whatever is in the  tag should be output to the screen which is why you are getting the dump

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)