From lapomme00 at gmail.com Thu Jul 26 00:44:08 2007 From: lapomme00 at gmail.com (Brett Walker) Date: Thu, 26 Jul 2007 10:14:08 +0530 Subject: [Cells-talk] Cell instance variables not valid on first call... Message-ID: I've just started playing with Cells. I remember seeing the original concept from Ezra many months ago, and thought it was a great idea. Now I'm needing them for a dashboard I'm putting together. I was glad to see that you've picked it up and taken it a little farther. The problem I'm having is that instance variables I set in the cell are always nil in the view for the first call to render_cell. If I call it again, the instance variables are fine. I see this even in the cell tutorial engine. There are two calls to <%= render_cell :tutorial, :state_with_view %> in the working_cells.rhtml. Only the second one shows the time. I'm running on Rails 1.2 with the latest Engines code. I put together an example cell in my main app directory (outside the scope of an engine) and the problem still occurs. Any ideas? Cheers, Brett From nick at tesbo.com Thu Jul 26 06:29:43 2007 From: nick at tesbo.com (Nick Sutterer) Date: Thu, 26 Jul 2007 12:29:43 +0200 Subject: [Cells-talk] Cell instance variables not valid on first call... In-Reply-To: References: Message-ID: <200707261229.44009.nick@tesbo.com> hey brett, > The problem I'm having is that instance variables I set in the cell > are always nil in the view for the first call to render_cell. ?If I > call it again, the instance variables are fine. > which version of zells are you using? i fixed "some parts" of this bug in version 0.1. but it still occurs under special conditions. two work-arounds: 1. let the first #render_cell in your view render an invisible view (sucks). 2. render the cells in your controller action with #render_cell_to_string and then put it in your view (sucks). i'm still investigating this bug, but it is really hard to spot since i have to dive deeply into the rails view-layer... any help is reeeaaally appreciated. hope this helps, please tell me whether it works or not. cheers, nick