Q:

'.each do' is leaving some line like "#"

I'm trying to prepare a json object for my rails app.
Here is my code:
#videos_controller

 def show
     @video = Video.find(:all,
                         :conditions => { :published => true, :trash => false },  
                         :order => 'RANDOM()', :limit => 1)

    respond_to do |format|
      format.html # show.html.erb
      format.json {render :partial => "videos/show.json"}
    end
  end

#_show.json
<%= @video.each do |video| %>
{
    "video_link": "<%= video.link %>",
    "video_id": "http://website.com/videos/each/<%=video.id%>"
}
<% end %>

but at videos/show.json I'm getting something like that
{
  "video_link": "http://www.youtube.com/watch?v=6rmWnwtps6I",
  "video_id": "http://website.com/videos/each/51"
}
#<Video:0x220a060>

How to avoid the nasty last line and were does it getting from? I think, becouse of that, it doesn't allow me to work with json object properly. I know, that answer is pretty simple, but just can't get it. Thank you in advance.

A:

Take out the equal sign in the line <%= @video.each do |video| %> so it's just <% @video.each do |video| %>.  The segment you're seeing is the default to_s method which is being returned from the each method.

