Created
July 18, 2010 14:22
-
-
Save devongovett/480437 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// #1. Standard hash, but with relationships defined outside of that hash | |
db.define('Employee', { | |
name: Record.type('String').required(), | |
employee_number: Record.type('Number').defaultValue(123) | |
}) | |
Employee.hasOne('Office') | |
// #2. Put relationships in hash - user can name them anything they want. | |
db.define('Employee', { | |
office: Record.hasOne('Office') | |
name: Record.type('String').required(), | |
employee_number: Record.type('Number').defaultValue(123), | |
}) | |
// #3. A (fab) like approach with relationships defined within the definition | |
with ( db ) | |
define('Employee') | |
( hasOne, 'Office' ) | |
( prop, 'name' ).type('String').required() | |
( prop, 'employee_number' ).type('Number').defaultValue(123) | |
(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment