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: shipping_services_controller.rb
    path of file: ./repos/workarea/admin/app/controllers/workarea/admin
    
    the code of the file until where you have to start completion: module Workarea
  class Admin::ShippingServicesController < Admin::ApplicationController
    required_permissions :settings
    befor
    
    def build_rules
      #this updates existing rates
      if params[:rates].present?
        params[:rates].each do |rate, attrs|
          if attrs[:price].present?
            attrs.each { |k,v| attrs[k] = nil if v.blank? }
            @service.rates.find(rate).update_attributes(attrs)
          end
        end