Skip to content

controller generator

Lance Pollard edited this page Apr 12, 2012 · 1 revision

Controller Generator

To create a Controller for the User model, execute the Controller Generator like this:

tower generate controller Post

The controller should generate a single controller file:

|-- app
|   |-- controllers
|   |   |   `-- postsController.coffee

The controller will initially be empty:

class App.PostsController extends Tower.Controller

Fill it out as needed:

class App.PostsController extends Tower.Controller
  @respondTo "html", "json"

  new: ->
    @posts = Post.all()

Tower.js

Everything here will be reflected on http://towerjs.org/guides.

Clone this wiki locally