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) %></option>         <% end %>                            </select>

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   e[4;36;1mCountry Columns (0.001348)e[0m e[0;1mSHOW FIELDS FROM `countries`e[0m

ActionView::TemplateError (stack level too deep) on line #17 of public/index.rhtml: 14: <!-- %=@countries.length()% --> 15: <select name="country" size="1" onchange="form.submit();"> 16: <% for country in @countries do %> 17: <option value="<%=country.id%>"><%= h(country.name) %></option> 18: <% end %> 19: </select> 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