-
Notifications
You must be signed in to change notification settings - Fork 120
~js vs coffee
Lance Pollard edited this page Sep 24, 2012
·
2 revisions
# config/application.js
App = Tower.Application.extend()
# app/models/user.js
App.User = Tower.Model.extend({
firstName: Tower.Model.Attribute.create(type: 'String')
})
# app/controllers/usersController.js
App.UsersController = Tower.Controller.extend(
index: function() {
var _this = this;
App.User.all(function(error, records) {
_this.render('index', {locals: {users: records}});
})
}
)
# config/application.coffee
class App extends Tower.Application
# app/models/user.coffee
class App.User extends Tower.Model
@field 'firstName'
# app/controllers/usersController.coffee
class App.UsersController extends Tower.Controller
index: ->
App.User.all (error, records) =>
@render 'index', locals: users: records