ref: master
app/controllers/my_profile/maps_controller.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
class MapsController < MyProfileController skip_before_filter :verify_authenticity_token, only: [:google_map] include CategoriesHelper 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!(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 search_city render :json => MapsHelper.search_city(params[:term]) end def search_state render :json => MapsHelper.search_state(params[:term]) end end |