Skip to content
This repository

geddy resource todo #167

Closed
babrah opened this Issue August 13, 2012 · 7 comments

2 participants

Prabhjeet Singh Larz Conwell
Prabhjeet Singh

I setup geddy startup app then i run this command : geddy resource todo
it worked ok. when i run app with command : geddy
it gives some kind of error and nothing shows on web browser, just looping and looping.

here my code from terminal:

Prabhjeets-MacBook-Pro:todo_app babrah$ geddy resource todo
[Added] app/models/todo.js
[Added] app/controllers/todos.js
[Added] Resource todos route added to config/router.js
[Added] todos view directory

Prabhjeets-MacBook-Pro:todo_app babrah$ geddy
[Mon, 13 Aug 2012 08:59:07 GMT] INFO Server starting with config: {
"environment": "development",
"workers": 1,
"port": 4000,
"debug": true,
"rotateWorkers": false,
"rotationWindow": 7200000,
"rotationTimeout": 300000,
"logDir": "/Users/babrah/node/todo_app/log",
"gracefulShutdownTimeout": 30000,
"heartbeatInterval": 5000,
"heartbeatWindow": 20000,
"staticFilePath": "/Users/babrah/node/todo_app/public",
"sessions": {
"store": "memory",
"key": "sid",
"expiry": 1209600
},
"cookieSessionKey": "sdata",
"metrics": null,
"i18n": {
"defaultLocale": "en-us",
"loadPaths": [
"/Users/babrah/node/todo_app/config/locales"
]
},
"ssl": null,
"model": {
"useTimestamps": false,
"forceCamel": true
},
"hostname": null,
"detailedErrors": true
}
[Mon, 13 Aug 2012 08:59:07 GMT] INFO Creating 1 worker process.
[Mon, 13 Aug 2012 08:59:07 GMT] INFO Server worker running in development on port 4000 with a PID of: 1121
[Mon, 13 Aug 2012 08:59:07 GMT] DEBUG LOGGING STARTED ============================================
[Mon, 13 Aug 2012 08:59:07 GMT] DEBUG ============================================================
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET / 1.1" 200 2292 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /css/bootstrap.responsive.min.css 1.1" 200 7680 "http://localhost:4000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /css/style.css 1.1" 200 822 "http://localhost:4000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /js/bootstrap.min.js 1.1" 200 20697 "http://localhost:4000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /js/jquery.min.js 1.1" 200 93868 "http://localhost:4000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /css/bootstrap.min.css 1.1" 200 71385 "http://localhost:4000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /img/whitey.png 1.1" 200 87134 "http://localhost:4000/css/style.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"
[Mon, 13 Aug 2012 08:59:11 GMT] 127.0.0.1 - - [Mon Aug 13 2012 14:29:11 GMT+0530 (IST)] "GET /favicon.ico 1.1" 200 318 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1"

timers.js:103
if (!process.listeners('uncaughtException').length) throw e;
^
Error: Partial template "index" not found in app/views/todos and app/views
at Error.errorConstructor (/usr/local/lib/node_modules/geddy/lib/response/errors.js:40:13)
at getTemplateData (/usr/local/lib/node_modules/geddy/lib/template/index.js:202:13)
at EventEmitter.Templater.partial (/usr/local/lib/node_modules/geddy/lib/template/index.js:106:18)
at EventEmitter.Templater.render (/usr/local/lib/node_modules/geddy/lib/template/index.js:91:10)
at EventEmitter.Templater.render (/usr/local/lib/node_modules/geddy/lib/template/index.js:84:22)
at controller.BaseController.renderTemplate (/usr/local/lib/node_modules/geddy/lib/base_controller.js:621:15)
at builtInFormats.html.handler (/usr/local/lib/node_modules/geddy/lib/response/format.js:23:18)
at response.formatContent (/usr/local/lib/node_modules/geddy/lib/response/index.js:56:22)
at controller.BaseController.respond (/usr/local/lib/node_modules/geddy/lib/base_controller.js:587:14)
at index (/Users/babrah/node/todo_app/app/controllers/todos.js:5:10)
[Mon, 13 Aug 2012 08:59:16 GMT] ERROR Worker 1121 died.

Larz Conwell

We've recently refactored the generators, and they act more like the Rails generators do now.

So "resources" don't include templates anymore, but still creates a templates directory for the resource.

Error: Partial template "index" not found in app/views/todos and app/views

Here it's telling you that the "index" template can't be found in the "todos" template directory, this is because no templates were created for you.

So for it to work, you'd have to either create an "index" template your self in "app/views/todos" or you can take a look at our "scaffold" command as it creates nearly everything for you.

Let me know if this solves your problem, and if you need more help.

Larz Conwell

Also what geddy version are you using? The comment above assumes you're using Geddy 0.4.4 which we just released a few weeks ago.

To figure out simply do geddy -v

Prabhjeet Singh

thank you, i am using geddy 0.4.4

Prabhjeet Singh

i had successfully added a basic geddy app on heroku : http://mighty-meadow-5935.herokuapp.com/
now i am learning its more features, so was going through its tutorial from nettuts and from geddy site.

Prabhjeet Singh

as you mentioned: "resources" don't include templates anymore
are you going to add any template system in geddy or documentation to add any template system?

Larz Conwell

Sorry for the late reply, that's pretty cool!

Before 0.4.4 only EJS templates could be used but since then it's been made so you can now use multiple template languages, and even different languages at the same time if you'd like(meaning you could have a layout in Jade, and template in EJS and a partial in Handlebars, and it would work.)

Currently we support EJS(.ejs), Jade(.jade), Mustache(.ms .mu, .mustache) and Handlebars(.hbs), and you don't have to do anything to use those engines, just have the template module installed and name the extension accordingly. Also we made some view helpers to go along with it, so some stuff can be done easier. They're very new so if you'd like to help make them better, we'd love that (:

If you'd like to learn more about the template system you can read the wiki's for them here and here

If you want to add templates to a resource you created, just go into the "app/views" directory for that resource and you can create the templates yourself.

For example to add a index template to a resource for "todo" just do:

$ geddy resource todo title:string finished:boolean
$ touch app/views/todos/index.html.jade

And now you'll have a empty Jade template to use for the index action on the todos controller.

Note: If you're using Jade ensure you have read the templating wiki, explaining how to use Jade layouts in Geddy.

Prabhjeet Singh

awesome, this is great to know that can use any template systen (:

Prabhjeet Singh babrah closed this August 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.