<commit_before>module.exports =
  InstanceMethods:
    index: ->
      @_index (error, resources) =>
        @respondWith
          html: -> "Ich habe #{resources.length} Einträge"
          json: -> @render json: resources

    _index: (callback) ->
      @scoped (err, scope) =>
        scope.all (err, resources) =>
          callback.apply @, [null, resources]

    show: ->
      @_show (err, resource) =>
        @respondWith
          html: -> "Name: #{resource.get("name")}"
          json: -> @render json: resource

    _show: (callback) ->
      @findResource (err, resource) =>
        unless resource
          return @_notFoundHandler()

        callback.apply @, [err, resource]

    create: ->
      @_create (error, resource) =>
        @respondWith
          html: -> "Created!"
          json: -> @render json: resource

    _create: (callback) ->
      data = @params[@resourceOptions.name]

      @resource().create data, (err, resource) =>
        if err
          return callback.apply @, [err, null]

        @response.status 201
        callback.apply @, [null, resource]

    update: ->
      @_update (err, resource) =>
        @respondWith
          html: -> "Yo success"
          json: -> @render json: resource

    _update: (callback) ->
      @findResource (err, resource) =>
        unless resource
         return @_notFoundHandler()

        data = @params[@resourceOptions.name]<commit_msg>Use scope for creating objects.<commit_after>module.exports =
  InstanceMethods:
    index: ->
      @_index (error, resources) =>
        @respondWith
          html: -> "Ich habe #{resources.length} Einträge"
          json: -> @render json: resources

    _index: (callback) ->
      @scoped (err, scope) =>
        scope.all (err, resources) =>
          callback.apply @, [null, resources]

    show: ->
      @_show (err, resource) =>
        @respondWith
          html: -> "Name: #{resource.get("name")}"
          json: -> @render json: resource

    _show: (callback) ->
      @findResource (err, resource) =>
        unless resource
          return @_notFoundHandler()

        callback.apply @, [err, resource]

    create: ->
      @_create (error, resource) =>
        @respondWith
          html: -> "Created!"
          json: -> @render json: resource, status: 201

    _create: (callback) ->
      data = @params[@resourceOptions.name]

      @scoped (err, scope) =>
        scope.create data, (err, resource) =>
          if err
            return callback.apply @, [err, null]

          callback.apply @, [null, resource]

    update: ->
      @_update (err, resource) =>
        @respondWith
          html: -> "Yo success"
          json: -> @render json: resource

    _update: (callback) ->
      @findResource (err, resource) =>
        unless resource
         return @_notFoundHandler()

        data = @params[@resourceOptions.name]
{'fraction_non_alphanumeric': 0.13850415512465375, 'fraction_numerical': 0.002077562326869806, 'mean_word_length': 1.9814241486068112, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1543307', 'n_tokens_mistral': 837, 'n_tokens_neox': 802, 'n_words': 214}