Skip to content

Commit

Permalink
keep group outside of attributes (no cyclic json)
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Pitiyanuvath committed Sep 30, 2011
1 parent 067c790 commit f3b8ccf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/javascripts/application.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Tractor.Group extends Backbone.Model

initialize: ->
@collection = new Tractor.Items @attributes.collection
@collection.invoke 'set', group: this
@collection.each ((i) -> i.group = this), this
@collection.bind 'remove', @resetAttributes, this
@collection.bind 'change:selected', @resetAttributes, this
@collection.bind 'change:cursor', @changeCursor, this
Expand Down Expand Up @@ -174,7 +174,7 @@ class Tractor.AllItems extends Tractor.Items
return unless val
@cursor().without(model).invoke 'set', cursor: false if val
i = @indexOf model # TODO slow
group = model.get 'group'
group = model.group
@_cursor =
if group.get('projectId') and not group.get('open')
items = group.collection
Expand Down
2 changes: 1 addition & 1 deletion test/group.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports =
group = newGroup item

assert.equal item, group.collection.models[0]
assert.equal group, item.get('group')
assert.equal group, item.group

'echos change:projectId on items': (beforeExit, assert) ->
item = new Tractor.Item
Expand Down

0 comments on commit f3b8ccf

Please sign in to comment.