This project is archived and is in readonly mode.

#4494 ✓ stale
Dylan Markow

Ruby 1.9.2-head's JSON support breaks to_json for arrays of records

Reported by Dylan Markow | April 28th, 2010 @ 05:54 AM | in 2.3.10

Ruby 1.9.2 development just upgraded "ext/json" from 1.1.9 to 1.4.1 on 4/26/10 (See http://redmine.ruby-lang.org/repositories/revision/1?rev=27493). When using ruby-head downloaded/compiled since yesterday, running to_json on an array of results (for example, Post.order("id").to_json) gives the following error. Is this something that needs support on Rails' end, or should this be pushed upstream as a bug with ruby?

ArgumentError (wrong number of arguments (2 for 1)):
  app/controllers/projects_controller.rb:4:in `to_json'
  app/controllers/projects_controller.rb:4:in `index'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/abstract_controller/base.rb:153:in `process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/rendering.rb:11:in `process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/instrumentation.rb:29:in `block in process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/notifications/instrumenter.rb:18:in `instrument'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/notifications.rb:48:in `instrument'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/instrumentation.rb:28:in `process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:443:in `_run__419509867057456517__process_action__4237787885856004072__callbacks'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88:in `run_callbacks'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/abstract_controller/callbacks.rb:17:in `process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/rescue.rb:8:in `process_action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/abstract_controller/base.rb:123:in `process'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/abstract_controller/rendering.rb:39:in `process'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal.rb:84:in `dispatch'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_controller/metal.rb:124:in `block in action'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/routing/route_set.rb:29:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/routing/route_set.rb:29:in `call'
  rack-mount (0.6.3) lib/rack/mount/route_set.rb:148:in `block in call'
  rack-mount (0.6.3) lib/rack/mount/code_generation.rb:89:in `block in recognize'
  rack-mount (0.6.3) lib/rack/mount/code_generation.rb:73:in `optimized_each'
  rack-mount (0.6.3) lib/rack/mount/code_generation.rb:88:in `recognize'
  rack-mount (0.6.3) lib/rack/mount/route_set.rb:139:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/routing/route_set.rb:458:in `call'
  warden (0.10.3) lib/warden/manager.rb:35:in `block in call'
  warden (0.10.3) lib/warden/manager.rb:34:in `catch'
  warden (0.10.3) lib/warden/manager.rb:34:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/activerecord-3.0.0.beta3/lib/active_record/query_cache.rb:31:in `block in call'
  /Users/dylan/.rvm/gems/ruby-head/gems/activerecord-3.0.0.beta3/lib/active_record/connection_adapters/abstract/query_cache.rb:35:in `cache'
  /Users/dylan/.rvm/gems/ruby-head/gems/activerecord-3.0.0.beta3/lib/active_record/query_cache.rb:11:in `cache'
  /Users/dylan/.rvm/gems/ruby-head/gems/activerecord-3.0.0.beta3/lib/active_record/query_cache.rb:30:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/activerecord-3.0.0.beta3/lib/active_record/connection_adapters/abstract/connection_pool.rb:365:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/head.rb:14:in `call'
  rack (1.1.0) lib/rack/methodoverride.rb:24:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/params_parser.rb:19:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/flash.rb:167:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/session/cookie_store.rb:107:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/cookies.rb:202:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:410:in `_run_call_callbacks'
  /Users/dylan/.rvm/gems/ruby-head/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88:in `run_callbacks'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
  rack (1.1.0) lib/rack/sendfile.rb:105:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/show_exceptions.rb:48:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/railties-3.0.0.beta3/lib/rails/rack/logger.rb:13:in `call'
  rack (1.1.0) lib/rack/runtime.rb:17:in `call'
  rack (1.1.0) lib/rack/lock.rb:11:in `block in call'
  <internal:prelude>:10:in `synchronize'
  rack (1.1.0) lib/rack/lock.rb:11:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/static.rb:30:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/railties-3.0.0.beta3/lib/rails/application.rb:132:in `call'
  /Users/dylan/.rvm/gems/ruby-head/gems/railties-3.0.0.beta3/lib/rails/application.rb:81:in `method_missing'
  /Users/dylan/.rvm/gems/ruby-head/gems/railties-3.0.0.beta3/lib/rails/rack/log_tailer.rb:15:in `call'
  rack (1.1.0) lib/rack/content_length.rb:13:in `call'
  rack (1.1.0) lib/rack/handler/webrick.rb:48:in `service'
  /Users/dylan/.rvm/rubies/ruby-head/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /Users/dylan/.rvm/rubies/ruby-head/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /Users/dylan/.rvm/rubies/ruby-head/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Referenced by

Pages