vendredi 29 mai 2015

no implicit conversion of nil into String (sponsorship )

I am getting the above error and it says that it has to do with the "+". Please note I did not code the below page, but I was told to fix it. If someone could help that would be awesome.

Sponsorship Controller

class SponsorshipController < ApplicationController
def index
@title = "Child Sponsorship: Help Children in Haiti by Becoming a Sponsor"
@meta = "Help a child in Haiti who is in need through sponsorship. Sponsorship provides children with food, care, clothing, shelter & education. Sponsor a child in Haiti today."
@txtname = params[:fname]
@txtemail = params[:email]
@txtstreet = params[:address]
@txtcity = params[:city]
@txtstate = params[:state]
@txtzip = params[:zip]

if @txtname.nil? || @txtname == '' || @txtstreet.nil? || @txtstreet == '' || @txtcity.nil? || @txtcity == '' || @txtstate.nil? || @txtstate == '' || @txtzip.nil? || @txtzip == ''
  @isvalid = false
  @testrequest='first time'
else
  @isvalid = true
  @prefs = " "
  if !params[:prefgirl].nil?
    @prefs = "Girl,"
  end
  if !params[:prefboy].nil?
    @prefs = @prefs + 'Boy,';
  end
  if !params[:prefkinder].nil?
    @prefs = @prefs + 'Kindergarten,';
  end
  if !params[:prefgrade].nil?
    @prefs = @prefs + 'Grade School,';
  end
  if !params[:prefhigh].nil?
    @prefs = @prefs + 'High School';
  end
  @data = {
    :childpreferences => @prefs,
    :fname => params[:fname], 
    :phone => params[:phonenumber],
    :fromaddress => params[:email], 
    :streetaddress => params[:address],
    :city => params[:city],
    :state => params[:state],
    :zip => params[:zip]        
  }

  @testrequest = @prefs
  ContactUsMailer.sponsorship_contact(@data).deliver
  ContactUsMailer.sponsorship_thankyou(@data).deliver
end
respond_to do |format|
  format.html {render :layout=>"homeLayout"}# haiti_one.html.erb
end
end

def say_yes
@title='Say Yes! Sponsor a Child Today!'
respond_to do |format|
  format.html {render :layout=>"homeLayout"}
end
end

end

FULL TRACE

app/controllers/mymoh_controller.rb:213:in +' app/controllers/mymoh_controller.rb:213:insponsorships' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/implicit_render.rb:4:in send_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:167:inprocess_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rendering.rb:10:in process_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:18:inblock in process_action' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:425:in _run__3687996442544047678__process_action__3216127983448203575__callbacks' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in__run_callback' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in _run_process_action_callbacks' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:inrun_callbacks' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:17:in process_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rescue.rb:29:inprocess_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:30:in block in process_action' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:inblock in instrument' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in instrument' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:ininstrument' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:29:in process_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/railties/controller_runtime.rb:18:in process_action' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:23:inblock in process_action' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:353:in perform_action_with_newrelic_trace' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:22:inprocess_action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:121:in process' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/abstract_controller/rendering.rb:45:inprocess' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal.rb:203:in dispatch' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal/rack_delegation.rb:14:indispatch' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_controller/metal.rb:246:in block in action' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:incall' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:in dispatch' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:36:incall' vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:68:in block in call' vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:ineach' vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/router.rb:56:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:601:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/rack/agent_hooks.rb:30:intraced_call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/rack/browser_monitoring.rb:23:intraced_call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/exception_notification-4.0.0/lib/exception_notification/rack.rb:28:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/best_standards_support.rb:17:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/etag.rb:23:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/head.rb:14:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/params_parser.rb:21:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/flash.rb:242:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:incontext' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/cookies.rb:341:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/query_cache.rb:64:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:28:in block in call' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in_run__790379348702901205__call__4407048364405463113__callbacks' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in __run_callback' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in_run_call_callbacks' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in run_callbacks' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:27:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb:31:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/show_exceptions.rb:56:incall' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in call' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:32:incall_app' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in block in call' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb:22:intagged' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/request_id.rb:22:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:72:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/static.rb:62:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:infetch' vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup' vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:incall!' vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-timeout-0.2.4/lib/rack/timeout.rb:108:in call' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/engine.rb:479:in call' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/application.rb:223:incall' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in method_missing' vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:incall' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/content_length.rb:14:in call' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/rack/log_tailer.rb:17:incall' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in block in pre_process' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:incatch' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in pre_process' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:53:inprocess' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in receive_data' vendor/bundle/ruby/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:inrun_machine' vendor/bundle/ruby/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in run' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:instart' vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/server.rb:162:in start' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/handler/thin.rb:13:inrun' vendor/bundle/ruby/2.1.0/gems/rack-1.4.5/lib/rack/server.rb:268:in start' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands/server.rb:70:instart' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:55:in block in <top (required)>' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:intap' vendor/bundle/ruby/2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in <top (required)>' script/rails:6:inrequire' script/rails:6:in `'

Aucun commentaire:

Enregistrer un commentaire