You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: affiliated_by_controller.rb
    path of file: ./repos/openfoodnetwork/engines/dfc_provider/app/controllers/dfc_provider/enterprise_groups
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module DfcProvider
  module EnterpriseGroups
    class AffiliatedByController < DfcProvider::ApplicationController
      def create
        gr
    
      def create
        group = EnterpriseGroup.find(params[:enterprise_group_id])

        authorize! :update, group

        enterprise_uri = RDF::URI.new(params[:@id])

        return head :bad_request unless enterprise_uri.valid?

        enterprise_id = ofn_id_from_uri(enterprise_uri)
        enterprise = Enterprise.find(enterprise_id)

        group.enterprises << enterprise

        head :created
      end