Strange view problem

I'm working with a Struct that I mapped from a raw sql query for a report. I finally get the search page to work and display my results, however the view when rendered not only displays the expected output; it also shows the Struct as it would look in the rails console!

my view is as follows:

<%=form_tag request.path,:method=>'get' do%> <%=select_tag 'advisors',options_from_collection_for_select(@advisors,"id","full_name") %> <%=submit_tag "Search",:name=>nil%> <%end%>

<div id="list">

<%=@assigned_students.each do |student| %> <%= render :partial => 'assigned_student',:collection=>student %> <%end%> </div>

The partial is as follows:

<%if @assigned_students.kind_of?(Array)%> <%=@assigned_students.each do |f|%> <p><%=f.student_name%></p> <p><%=f.advisor%></p> <p><%=f.semester%></p>

<%end%> <%else%> <p><%=@assigned_students.student_name%></p> <p><%=@assigned_students.advisor%> </p> <p><%=@assigned_students.semester%>> </p> <%end%>

The relevant controller code is as follows: (I've removed the sql query string itself for readability.)

AdvisorList=Struct.new(:student_name,:advisor,:semester) def advisor_list     @advisors=Advisors.all

#get_results respond_to do |format|   format.html   unless params[:advisors].nil?         #long query removed from here @assigned_students=query.map{|m|AdvisorList.new(m["Student Name"],m["Advisor"],m["Semester"])       }       format.html     end #end respond_to     end #ends unless   end # ends method

Does anyone here understand what could be the problem?

I've had this before, too. But not so recently that I readily remember what was wrong. Cobwebs suggest it was not much more than a syntax error.

In your controller you have a close brace but no open brace, which causes my eye to notice that you also have two format.html calls. Is there something else missing, or could that be the issue?

Try removing stuff from your view until the unexpected output disappears, then you will know which line of code is showing the unwanted output. I hope you are using a Source Control System such as git so that you can easily get back to where you started.

Colin

Take the "=" out of the front of the .each call.

Removing the entire loop from the calling view seems to have solved the issue. Thanks everyone.

@Jim I was trying to have the partial render on the same page that the search was being done on to see whether the output was different on that page. That code is such a dirty hack as it stands right now.