Created
November 26, 2011 21:21
-
-
Save almost/1396310 to your computer and use it in GitHub Desktop.
First example from: http://almostobsolete.net/declarative-models-in-coffeescript.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post extends Model | |
@field 'title', default: 'New post!' | |
@field 'body' | |
# the default is supplied as a closure which is evaluated at object | |
# creation time | |
@field 'created_at', default: -> new Date() | |
class User extends Model | |
@field 'username' | |
@field 'twitter' | |
@has_many Post, as: 'posts' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment