From mike.pence at gmail.com Tue Feb 19 14:05:52 2008 From: mike.pence at gmail.com (Mike Pence) Date: Tue, 19 Feb 2008 14:05:52 -0500 Subject: [Cells-talk] Partials? Message-ID: So, I have been using Cells with great success these last several days. I have a situation where I need multiple cell states share the same logic, and I seem to recall that there is no such thing as partials in Cells. Any recommended approaches for this? Also, I have InfoQ.com on board for a Cells article as a feature in the coming weeks. That should be some great exposure. Best, Mike Pence From Peter.Bex at solide-ict.nl Wed Feb 20 03:19:39 2008 From: Peter.Bex at solide-ict.nl (Peter Bex) Date: Wed, 20 Feb 2008 09:19:39 +0100 Subject: [Cells-talk] Partials? In-Reply-To: References: Message-ID: <20080220081939.GA1499@darko.solide-ict.nl> On Tue, Feb 19, 2008 at 02:05:52PM -0500, Mike Pence wrote: > So, I have been using Cells with great success these last several > days. I have a situation where I need multiple cell states share the > same logic, and I seem to recall that there is no such thing as > partials in Cells. Any recommended approaches for this? If I understand your problem correctly, you want to have some place where you can put logic that is used by more than one state. Perhaps simply creating a protected method in your Cell's class would do. If the cell states are spread across several Cells you could do one of two things, depending what fits your domain best: 1. Create a module in which you put the protected methods and include it in the cells which need the shared code. 2. Create a subclass from Cell::Base, put the shared logic there and make your cells inherit from that (abstract) cell. On the other hand, your use of the term 'partials' seems to suggest you're looking for a way to share view code. But that would just be handled by Cells, wouldn't it? You can render cells recursively, so if you have a FooCell with state some_state, you can simply put a render_cell :foo, :some_state call in the view for some_state. Of course, you'll need a recursion termination condition or this will cause a stack overflow :) HTH > Also, I have InfoQ.com on board for a Cells article as a feature in > the coming weeks. That should be some great exposure. This is excellent news! Thanks a lot! Cheers, Peter Bex Solide ICT - http://www.solide-ict.nl From apotonick at gmail.com Wed Feb 20 07:42:41 2008 From: apotonick at gmail.com (Nick Sutterer) Date: Wed, 20 Feb 2008 13:42:41 +0100 Subject: [Cells-talk] Fwd: Partials? In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Nick Sutterer Date: Feb 20, 2008 1:24 PM Subject: Re: [Cells-talk] Partials? To: Mike Pence > So, I have been using Cells with great success these last several > days. I have a situation where I need multiple cell states share the > same logic, and I seem to recall that there is no such thing as > partials in Cells. Any recommended approaches for this? > this sounds like you want to render another cell state (which contains the shared logic) instead of rendering a partial (as peter said). > Also, I have InfoQ.com on board for a Cells article as a feature in > the coming weeks. That should be some great exposure. > this is great! cool! nick From mike.pence at gmail.com Mon Feb 25 10:55:15 2008 From: mike.pence at gmail.com (Mike Pence) Date: Mon, 25 Feb 2008 10:55:15 -0500 Subject: [Cells-talk] Helpers? Message-ID: Hey guys, I ran into a situation where I need to use a Helper's method in my code, but do not recall where don't recall how to use them in Cells. Any help appreciated. Also, though this was interesting but have not had time to read it: http://cfis.savagexi.com/articles/2008/02/11/reusing-rails-controllers-is-a-good-thing Best, Mike Pence From mike.pence at gmail.com Mon Feb 25 11:03:35 2008 From: mike.pence at gmail.com (Mike Pence) Date: Mon, 25 Feb 2008 11:03:35 -0500 Subject: [Cells-talk] Helpers? In-Reply-To: References: Message-ID: Nevermind, found it here: http://cells.rubyforge.org/rdoc/index.html However, it does not seem to be working, since the code I need is in ApplicationHelper and it is inaccessible in my cell. So, once I put: helper :application in my code, and it works. So, this is a bug, or at least is inconsistent with the docs. ApplicationHelper needs to be included automatically. Can we create a ticket for that in our bug tracking database? Where and how could I do that? Best, Mike Pence On Mon, Feb 25, 2008 at 10:55 AM, Mike Pence wrote: > Hey guys, > > I ran into a situation where I need to use a Helper's method in my > code, but do not recall where don't recall how to use them in Cells. > Any help appreciated. > > Also, though this was interesting but have not had time to read it: > http://cfis.savagexi.com/articles/2008/02/11/reusing-rails-controllers-is-a-good-thing > > Best, > Mike Pence > From apotonick at gmail.com Tue Feb 26 05:23:49 2008 From: apotonick at gmail.com (Nick Sutterer) Date: Tue, 26 Feb 2008 11:23:49 +0100 Subject: [Cells-talk] Helpers? In-Reply-To: References: Message-ID: hey ho mike! > Nevermind, found it here: http://cells.rubyforge.org/rdoc/index.html > i know, i know, we need more docs. i decided to create a Cells Cookbook, since cookbooks rule. you can just start writing down examples instead of thinking HOW to arrange your 20-page tutorial. any help appreciated. > However, it does not seem to be working, since the code I need is in > ApplicationHelper and it is inaccessible in my cell. So, once I put: > > helper :application > this is really strange. if you have a look at Cell::Base#helper_modules, you can see that we include the ApplicationHelper by default. i will investigate on that. what YOU want is to include the "official rails ApplicationHelper", which is included in every rails view? > in my code, and it works. So, this is a bug, or at least is > inconsistent with the docs. ApplicationHelper needs to be included > automatically. Can we create a ticket for that in our bug tracking > database? Where and how could I do that? > tickets can be created at rubyforge. i guess you need an account, but i'm not sure. cheers, nick > Best, > Mike Pence > > > > On Mon, Feb 25, 2008 at 10:55 AM, Mike Pence wrote: > > Hey guys, > > > > I ran into a situation where I need to use a Helper's method in my > > code, but do not recall where don't recall how to use them in Cells. > > Any help appreciated. > > > > Also, though this was interesting but have not had time to read it: > > http://cfis.savagexi.com/articles/2008/02/11/reusing-rails-controllers-is-a-good-thing > > > > Best, > > Mike Pence > > > _______________________________________________ > Cells-talk mailing list > Cells-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/cells-talk > From Peter.Bex at solide-ict.nl Tue Feb 26 07:41:13 2008 From: Peter.Bex at solide-ict.nl (Peter Bex) Date: Tue, 26 Feb 2008 13:41:13 +0100 Subject: [Cells-talk] Helpers? In-Reply-To: References: Message-ID: <20080226124113.GB13509@darko.solide-ict.nl> On Tue, Feb 26, 2008 at 11:23:49AM +0100, Nick Sutterer wrote: > > However, it does not seem to be working, since the code I need is in > > ApplicationHelper and it is inaccessible in my cell. So, once I put: > > > > helper :application > > > this is really strange. if you have a look at > Cell::Base#helper_modules, you can see that we include the > ApplicationHelper by default. i will investigate on that. what YOU > want is to include the "official rails ApplicationHelper", which is > included in every rails view? Are you on trunk? I think we made some changes to the helper code after making release 1.0 Cheers, Peter Bex Solide ICT - http://www.solide-ict.nl