Skip to content

Coffeescript Problems #59

@jkarmel

Description

@jkarmel

Hey guys,

First off, this library is totally awesome and also badly needed in the angular community. I'm incredibly happy to see it!

Secondly, I have the following coffeescript model:

angular.module('models').
factory 'Account', [\
"ActiveResource"
(ActiveResource) ->
  Account = (data) ->
    @number 'id'
    @string 'phone_number'

    @hasMany 'orders'

  Account.inherits ActiveResource.Base
  Account.api.set('/accounts').format 'json'
  Account
]

Part of the code that makes associations work in your library fails because Account.name returns "" instead of "Account". I can use the class keyword to get the right behavior but that won't survive minification. (I think)

Can you guys support a .className property that gets set explicitly?

For reference here is an example using the name property in your code:

function nameOfBelongsToModel(model) {
  if (!model)
    return;
  if (!model.klass && !model.name)
    return;
  if (!model.klass)
    return model.name.camelize();
  return model.klass.name.camelize();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions