forked from tower-archive/tower
-
Notifications
You must be signed in to change notification settings - Fork 0
resources
Lance Pollard edited this page Apr 12, 2012
·
1 revision
Tower goes by the convention that every controller represents one resource, one model.
A controller doesn't need to follow these conventions, for example with a DashboardController
or SearchController
. In those cases, overriding the methods starts you with a clean slate. However, you'll quickly see how powerful this is.
You can customize the variable names and resource type:
class App.PostsController extends Tower.Controller
@resource type: "Article", collection: "articles", resource: "article", key: "data", id: "dataId"
The default implementation for a Tower.Controller
looks like this:
class App.PostsController extends Tower.Controller
index: ->
new: ->
create: ->
show: ->
edit: ->
update: ->
destroy: ->