Stack level too deep

Hi there

I’m coding a web application which, I hope so, will have a lot of
visitors. The thing is that I did it using models to all the database
accesses and now I have inserted a cache layer in the middle in order
to retrieve “massive” information (countries, user types, etc.) which
is not updated too often.

My cache (my first approach) is a class which contains a Hash table and
retrieve all the country objects the first time and provide the objects
from the hash the rest during 30 minutes. The first time I retrieve
info (from DB) it works fine, but the second one, the info is returned
from the hash and give the ‘stack level too deep’ when is printed in
the rhtml page.

The chunk of code which put countries in a combobox is:

                      <select name="country" size="1">
    <% for country in @countries do %>
                            <option value="<%=country.id%>"><%=

h(country.name) %>
<% end %>

and the error printed is:

Processing PublicController#index (for 192.168.200.1 at 2008-08-02
20:04:59) [GET] Session ID: b8b9be8725273e46041d785f9af2d30b
Parameters: {“action”=>“index”, “controller”=>“public”}
Time.now : Sat Aug 02 20:04:59 +0200 2008
@@max_lt : Sat Aug 02 20:34:51 +0200 2008
Retrieved cached data.
Rendering public/index
[4;36;1mCountry Columns (0.001348) [0m [0;1mSHOW FIELDS FROM
countries [0m

ActionView::TemplateError (stack level too deep) on line #17 of
public/index.rhtml: 14: 15:
16: <% for country in @countries
do %> 17: <%= h(country.name) %>
18: <% end %>
19: 20: <% end %>

Notice that this time the info is retrieved from the hashtable
(Retrieved cached data.).

I have checked google and there is a lot of info about this error but I
haven’t found any error like mine.

Could you help me with this problem?

Thanks in advance

Best regards

Miquel (a.k.a. Ktalà a.k.a. Ton)
Linux User #286784
GPG Key : 4D91EF7F
Debian GNU/Linux (Linux wolverine 2.6.23.1)

Welcome to the jungle, we got fun and games
Guns n’ Roses

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