Forum: Ruby on Rails picture album problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1b91b9685655b5e8a9dd75c184fc5d40?d=identicon&s=25 unknown (Guest)
on 2007-06-18 20:56
(Received via mailing list)
Hi all,

I am trying me newly created photo album and after uploading one pic I
am having a problem with displaying this particular album.

ActionView::TemplateError (negative string size (or size too big)) on
line #14 of app/views/album/show.rhtml:11: <% if @album.pictures.size
> 0 %>12:        <div id="photos">13: <h2>Foto's</h2>14:         <%
for photo in @album.pictures %>15:           <%= show_thumb photo
%>16:           <%= draggable_element("#{photo.id}", :revert => true)
%>17:         <% end %>    /usr/local/lib/ruby/gems/1.8/gems/
activerecord-1.14.4/lib/active_record/connection_adapters/
postgresql_adapter.rb:406:in `unescape_bytea'    /usr/local/lib/ruby/
gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:406:in `unescape_bytea'    /
usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:373:in `select'    /usr/
local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:368:in `each_index'    /usr/
local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:368:in `select'    /usr/
local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:366:in `each'    /usr/local/
lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:366:in `select'    /usr/
local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/postgresql_adapter.rb:129:in `select_all'    /usr/
local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
base.rb:390:in `find_by_sql'    /usr/local/lib/ruby/gems/1.8/gems/
activerecord-1.14.4/lib/active_record/base.rb:924:in `find_every'    /
usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
base.rb:381:in `find'    /usr/local/lib/ruby/gems/1.8/gems/
activerecord-1.14.4/lib/active_record/associations/
has_many_association.rb:83:in `find'    /usr/local/lib/ruby/gems/1.8/
gems/activerecord-1.14.4/lib/active_record/associations/
has_many_association.rb:111:in `find_target'    /usr/local/lib/ruby/
gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/
association_proxy.rb:116:in `load_target'    /usr/local/lib/ruby/gems/
1.8/gems/activerecord-1.14.4/lib/active_record/associations/
association_proxy.rb:109:in `method_missing'    /usr/local/lib/ruby/
gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/
has_many_association.rb:90:in `method_missing'    #{RAILS_ROOT}/app/
views/album/show.rhtml:14:in `_run_rhtml_album_show'

It seems I am hitting a string limit in that for loop, am I doing
something wrong or is there a better way to do exactly this? The pics
are stored in the database so I guess that last added picture is seen
as a string and hits the limit.

Anyone here who knows a nice solution?

Regards,
Wijnand
This topic is locked and can not be replied to.