From mhassman at igs2.com Wed May 23 13:05:34 2007 From: mhassman at igs2.com (Marc Hassman) Date: Wed, 23 May 2007 12:05:34 -0500 Subject: [Cells-talk] Can't access instance variables set in Controller inside cell Message-ID: <4654745E.7000402@igs2.com> Suppose @a is set in my controller. Now suppose @b is set in my cell. I am currently unable to access @a from inside my cell, although I can access both @a and @b just fine from the cell view. Is this intentional? Thanks, Marc H From nick at tesbo.com Thu May 24 06:34:44 2007 From: nick at tesbo.com (Nick Sutterer) Date: Thu, 24 May 2007 12:34:44 +0200 Subject: [Cells-talk] Can't access instance variables set in Controller inside cell In-Reply-To: <4654745E.7000402@igs2.com> References: <4654745E.7000402@igs2.com> Message-ID: <200705241234.44987.nick@tesbo.com> hey marc, > Suppose @a is set in my controller. Now suppose @b is set in my cell. > > I am currently unable to access @a from inside my cell, although I can > access both @a and @b > just fine from the cell view. > > Is this intentional? > well, yes, this is intention. to access @a in your cell you have to do @controller.a since cells are here for encapsulation, they usually don't (or shouldn't!) need instance variables from the controller. if you need them anyway you can go via the @controller reference in your cell. but please note that this will limit the application field of your cell; using the cell in another controller is impossible then, due to your access to private controller data. hope this helps, thanks for you interest! cheers, nick From mhassman at igs2.com Thu May 24 09:21:21 2007 From: mhassman at igs2.com (Marc Hassman) Date: Thu, 24 May 2007 08:21:21 -0500 Subject: [Cells-talk] Can't access instance variables set in Controller inside cell In-Reply-To: <200705241234.44987.nick@tesbo.com> References: <4654745E.7000402@igs2.com> <200705241234.44987.nick@tesbo.com> Message-ID: <46559151.7020805@igs2.com> I see. That makes total sense from the 'unrelated widgets on a page' requirement. I am tasked with the 1000lb RoR gorilla in the room of modularizing an (most likely unreusable) app without getting too far from the rails mindset, so I am glad I can still get to them. I don't think I saw this documented however. It might be worth including a note to stop annoyances from upstream swimmers like me :) Thanks for your efforts, Marc H Nick Sutterer wrote: > hey marc, > > >> Suppose @a is set in my controller. Now suppose @b is set in my cell. >> >> I am currently unable to access @a from inside my cell, although I can >> access both @a and @b >> just fine from the cell view. >> >> Is this intentional? >> >> > well, yes, this is intention. to access @a in your cell you have to do > @controller.a > > since cells are here for encapsulation, they usually don't (or shouldn't!) > need instance variables from the controller. if you need them anyway you can > go via the @controller reference in your cell. > but please note that this will limit the application field of your cell; using > the cell in another controller is impossible then, due to your access to > private controller data. > > hope this helps, thanks for you interest! > > cheers, > > > nick > _______________________________________________ > Cells-talk mailing list > Cells-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/cells-talk > > >