Image Rendering Problem

Here’s the rundown of the problem that I’m having:

I have a page that I am rendering that has multiple icons being
displayed. The icons are being stored as binary files in the database.
When I load the page with a collection of items (icons) to be
displayed, not all of the icons are being displayed. In fact, the
icons which actually get displayed seem a bit random.

From the main html file, a partial is called for each of the items:

<% if @new_items -%>
    <li><%= render :partial => 'shared/item', :collection =>

@new_items, :spacer_template => ‘shared/li’ %>

<% end -%>

Inside the partial, each image is rendered with the following code:

<img src="<%= url_for(:action => 'get_icon',  :id => %>"

alt=“Unable to Display” class=“uas-app-icon-link”/>

The get_icon method is just a function which contains the following:

def get_icon
    item = ItemDocument.find(:all, :conditions => ["item_id == ?

id == (SELECT
id == ?)",
icon = item[0]
:type => icon.content_type, :disposition =>

Anyways, only some of that actual images are actually rendered when
the page is complete. I checked to see whether the urls exist for each
image, and all of the image urls are fine; they render just as they
should. I have tried using both WEBrick and Mongrel in my server
configuration of the localhost. WEBrick is a bit better, but both of
them still fail to some extent. The server log for WEBrick is the

Processing ApplicationController#get_icon (for at

2009-09-01 15:45:05) [GET]
Parameters: {“id”=>“2”}

ArgumentError (A copy of ApplicationController has been removed

from the module tree but is still active!):
app/controllers/application_controller.rb:15:in initialize' C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
run' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
start' -e:1:inload’

Rendered rescues/_trace (47.0ms)
Rendered rescues/_request_and_response (2.0ms)
Rendering rescues/layout (internal_server_error)

Currently I am using sqlite3 v3.6.17 (gem) and rails v2.3.3 if that
helps any. I did try making a quick temporary project that did the
same kind of rendering with send_data and an iterating partial call,
and it has the same behavior. I tried using both sqlite and mysql
v5.0.85 (v2.8.1 gem), and the results were the same. Any help at this
point would be greatly appreciated. I am a beginner just to let you
know, just FYI for those who might be able to help out. Thanks in

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs