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 -%>
      <ol>
        <li><%= render :partial => 'shared/item', :collection =>
@new_items, :spacer_template => 'shared/li' %></li>
      </ol>
    <% end -%>


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

    <img src="<%= url_for(:action => 'get_icon',  :id => item.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 == ?
AND
                                                       id == (SELECT
icon_id
                                                              FROM
items
                                                              WHERE
id == ?)",
                                                       params[:id],
params[:id]])
        icon = item[0]
        send_data(icon.file,
                        :type => icon.content_type, :disposition =>
"inline")
    end


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
following:

    Processing ApplicationController#get_icon (for 127.0.0.1 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:in
`service'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
`run'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:95:in
`start'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:in
`start'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:23:in
`start'
      C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:82:in
`start'
      -e:1:in `load'
      -e:1

    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
advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to