1602/express-on-railway — Issue #123: Has Many relationship crashes the app
Author: premjg
Created: 2012-02-22 18:02:14+00:00
State: open

Here's what I get when I start the server:

```
★ Wed Feb 22 23:25:27 trolly2 nodemon server.coffee
22 Feb 23:25:28 - [nodemon] v0.6.9
22 Feb 23:25:28 - [nodemon] watching: /Users/prem/Desktop/My Work Dropbox/Dropbox/My Work/projects/trolly2
22 Feb 23:25:28 - [nodemon] starting `coffee server.coffee`
Error while executing /Users/prem/Desktop/My Work Dropbox/Dropbox/My Work/projects/trolly2/db/schema.coffee
TypeError: Cannot read property '_scopeMeta' of undefined
at defineScope (/Users/prem/Desktop/My Work Dropbox/Dropbox/My Work/projects/trolly2/node_modules/railway/node_modules/jugglingdb/lib/abstract-class.js:524:25)
at Function.hasMany (/Users/prem/Desktop/My Work Dropbox/Dropbox/My Work/projects/trolly2/node_modules/railway/node_modules/jugglingdb/lib/abstract-class.js:453:5)
```

Here's my schema.coffee

```javascript
User = describe 'User', () ->
property 'email', String
property 'first_name', String
property 'last_name', String
property 'gender', String
property 'mobile_number', String
property 'home_phone_number', String
property 'address', Text
property 'zip', String
property 'city', String
property 'country', String
property 'latitude', String
property 'longitude', String
property 'timezone', String
property 'locale', String
property 'birthday', Date
property 'status', String
property 'createdAt', Date, default: Date
property 'updatedAt', Date, default: Date

User.hasMany(Authentication, {as: 'authentications', foreignKey: 'userId'})

Authentication = describe 'Authentication', () ->
property 'userId', String
property 'platform', String
property 'platformUserId', String
property 'createdAt', Date, default: Date
property 'updatedAt', Date, default: Date

Authentication.belongsTo(User, {as: 'user', foreignKey: 'userId'})
```

When I comment out the relationship lines (User.hasMany... and Authentication.belongsTo..) the app start normally.