Checking all checkboxes


I’m using the following code to check all my checkbox in a table:

  check: null
  delete: Ember.computed 'model.@each.checked', () ->
    count = 0

    @get('model').forEach((item) =>
      if item.get 'checked'
        count = count + 1
        count = count

    if count >= 1
      result = true
      result = false

So, i have a general check box input with the value of check, if the person clicks, the observer will set the property of all itens in my model to true. This is working pretty well. The problem is… i’m using the code in many controllers, and i think that’s not DRY at all. So, i would like to know how exactly use in just one controller and inherit from the same controller, in other controllers.

Thanks in advance!!!