KarenManukyan
KarenManukyan

Reputation: 73

ruby on rails - parsing url

I've a problem with receive data in controller. I must receive params in web service controller but I have follow problem with that.I researched and found that problem in rails parse this is article about that article .I would like find some way for parse it myself.I just want take last same item of ulr for example job_name=*. I have not receive any data in controller after this error. this is request request and error.


localhost:3000/ws/job_histories/index?job_name=name&job_name[]=*

Status: 500 Internal Server Error

undefined method each_pair' for nil:NilClass
org/jruby/RubyKernel.java:238:in
method_missing'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in method_missing'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb:46:in
update'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb:91:in merge'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/request.rb:385:in
parameters'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/base.rb:1290:in assign_shortcuts'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/base.rb:527:in
process'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in process_with_filters'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/rescue.rb:65:in
call_with_exception'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:90:in dispatch'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in
dispatch'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:85:in dispatch'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in
_call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in build_middleware_stack' org/jruby/RubyProc.java:270:incall'
org/jruby/RubyProc.java:220:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/head.rb:9:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
cache'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in cache'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/lock.rb:11:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/lock.rb:11:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in
run'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/railties/lib/rails/rack/static.rb:31:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/urlmap.rb:49:in call' org/jruby/RubyArray.java:1612:ineach'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/content_length.rb:13:in call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/chunked.rb:15:in
call'
C:/skybot/int_3_6/skybot-2.0/gui/vendor/gems/rack-1.1.3/lib/rack/handler/mongrel.rb:67:in process'
C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in
process_client' org/jruby/RubyArray.java:1612:in each'
C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
process_client'
C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:110:in process_client'
C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run' org/jruby/RubyProc.java:270:in call'
org/jruby/RubyProc.java:224:in
call'

Upvotes: 1

Views: 193

Answers (1)

Richard Peck
Richard Peck

Reputation: 76774

I was going to write a comment, but it will be clearer here:

undefined method each_pair' for nil:NilClass

This error means you're calling a method / function on a data object which doesn't exist. Considering you're trying to call data from an endpoint, you need to show us the index action you're using

localhost:3000/ws/job_histories/index?job_name[]=name

This should set: params[:job_name] which you'll be able to access from your controller action

Upvotes: 1

Related Questions