On Thursday, June 28, 2012 5:36:17 PM UTC+10, James Wyse wrote:
> I'm trying to set up an Admin namespace but it doesn't seem to be working.
> I'm using the syntax from the documentation but perhaps I've messed up the
> syntax.
> I get an express error:
>> *Express*
>> *500* *RouterError: No controller for Admin::UsersController#index*
>> at Locomotive.
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/lib/locomotive/router .js:420:19)
>> at callbacks
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ lib/router/index.js:272:11)
>> at param
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ lib/router/index.js:246:11)
>> at pass
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ lib/router/index.js:253:5)
>> at Router._dispatch
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ lib/router/index.js:280:4)
>> at Object.handle
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ lib/router/index.js:45:10)
>> at next
>> (/Users/james/Sites/sops-loco/node_modules/locomotive/node_modules/express/ node_modules/connect/lib/http.js:204:15)
>> at Object.oncomplete
>> (/Users/james/Sites/sops-loco/node_modules/express/node_modules/connect/lib /middleware/static.js:159:11)
> *config/routes.js*
>> module.exports = function routes() {
>> this.root('test#index');
>> this.namespace('admin', function() {
>> this.resources('users');
>> });
>> };
> *app/controllers/admin/users_controller.js*
> var locomotive = require('locomotive'),
>> Controller = locomotive.Controller;
>> var UsersController = new Controller();
>> UsersController.index = function() {
>> this.title = "Users";
>> this.render();
>> };
>> module.exports = UsersController;
> I've tried my controller without the namespace and it works fine. Any help
> appreciated, cheers!