<commit_before>class MapsController < MyProfileController

  protect 'edit_profile', :profile

  def edit_location
    @profile_data = profile
    if request.post?
      begin
        country = params[:profile_data][:country]
        city = params[:profile_data][:city]
        state = params[:profile_data][:state]
        nregion = NationalRegion.validate!(city, state, country)
        unless nregion.blank?
          params[:profile_data][:national_region_code] = nregion.national_region_code
        end

        Profile.transaction do
          if profile.update_attributes!(params[:profile_data])
            session[:notice] = _('Address was updated successfully!')
            redirect_to :action => 'edit_location'
          end
        end
      rescue Exception => exc
        flash[:error] = exc.message
      end
    end
  end

  def google_map
    render :partial => 'google_map.js'
  end

  def search_city

    term = params[:term];

    regions = NationalRegion.search_city(term + "%", true).map {|r|{ :label => r.city , :category => r.state}}
<commit_msg>Expire LocationBlock cache on profile's location change<commit_after>class MapsController < MyProfileController

  protect 'edit_profile', :profile

  def edit_location
    @profile_data = profile
    if request.post?
      begin
        country = params[:profile_data][:country]
        city = params[:profile_data][:city]
        state = params[:profile_data][:state]
        nregion = NationalRegion.validate!(city, state, country)
        unless nregion.blank?
          params[:profile_data][:national_region_code] = nregion.national_region_code
        end

        Profile.transaction do
          if profile.update_attributes!(params[:profile_data])
            BlockSweeper.expire_blocks profile.blocks.select{ |b| b.class == LocationBlock }
            session[:notice] = _('Address was updated successfully!')
            redirect_to :action => 'edit_location'
          end
        end
      rescue Exception => exc
        flash[:error] = exc.message
      end
    end
  end

  def google_map
    render :partial => 'google_map.js'
  end

  def search_city

    term = params[:term];

    regions = NationalRegion.search_city(term + "%", true).map {|r|{ :label => r.city , :category => r.state}}

{'fraction_non_alphanumeric': 0.105562855891371, 'fraction_numerical': 0.0, 'mean_word_length': 2.7940199335548175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4220221', 'n_tokens_mistral': 644, 'n_tokens_neox': 624, 'n_words': 147}