From: Tom Hughes Date: Sun, 10 Jun 2007 16:29:15 +0000 (+0000) Subject: Use params[] instead of @params[] to avoid deprecation warnings. X-Git-Tag: live~8397 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/0f727ece17c09c975526d61b04c7ff13965b90e0?ds=sidebyside Use params[] instead of @params[] to avoid deprecation warnings. --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 541e0f840..5b2f6bcc2 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -98,10 +98,10 @@ class TraceController < ApplicationController def create filename = "/tmp/#{rand}" - File.open(filename, "w") { |f| f.write(@params['trace']['gpx_file'].read) } - @params['trace']['name'] = @params['trace']['gpx_file'].original_filename.gsub(/[^a-zA-Z0-9.]/, '_') # This makes sure filenames are sane - @params['trace'].delete('gpx_file') # remove the field from the hash, because there's no such field in the DB - @trace = Trace.new(@params['trace']) + File.open(filename, "w") { |f| f.write(params[:trace][:gpx_file].read) } + params[:trace][:name] = params[:trace][:gpx_file].original_filename.gsub(/[^a-zA-Z0-9.]/, '_') # This makes sure filenames are sane + params[:trace].delete('gpx_file') # remove the field from the hash, because there's no such field in the DB + @trace = Trace.new(params[:trace]) @trace.inserted = false @trace.user = @user @trace.timestamp = Time.now @@ -178,11 +178,11 @@ class TraceController < ApplicationController filename = "/tmp/#{rand}" File.open(filename, "w") { |f| f.write(request.raw_post) } - @params['trace'] = {} - @params['trace']['name'] = params[:filename] - @params['trace']['tagstring'] = params[:tags] - @params['trace']['description'] = params[:description] - @trace = Trace.new(@params['trace']) + params[:trace] = {} + params[:trace][:name] = params[:filename] + params[:trace][:tagstring] = params[:tags] + params[:trace][:description] = params[:description] + @trace = Trace.new(params[:trace]) @trace.inserted = false @trace.user = @user @trace.timestamp = Time.now