Mail archive

Re: [Acf] Demo of loading one controller from within another

From: Nathan Angelacos <>
Date: Sat, 05 Jul 2008 11:17:32 -0400

Natanael Copa wrote:
> On Fri, 2008-07-04 at 13:45 -0400, Nathan Angelacos wrote:
>> svn://
>> Now contains a demo acf that shows how one controller can load and call
>> a second one. You get to it via acf with:
> I think the problem was how to execute a function in another *model*,
> not another controller.
> foo-controller:
> bar = require("bar-model")
> function stuff()
> self.model.someting()
> bar.otherfunc()
> end

You should never require models or controllers directly; they need to
have their metatables set up correctly via the new function. You
should only require things in lib - not app.

The demo has been extended to show how to call model functions; just
call subcontroller.model:function() (or subcontroller.model.function, if
the function doesn't reference self)

> i guess the answer is to wrap the neede model funcs in the controller.

nope - just reference the controller's "model" table.
Received on Sat Jul 05 2008 - 11:17:32 UTC