Joerg Battermann
2009-Feb-14 03:05 UTC
Rails 2.3: format.xml / .json and/or render :xml => @users etc broken?
Good evening, I''ve just switched a project to Rails 2.3 RC1 (and just now to the latest version from github just to make sure the same error is still there) & for some reason I am having troubles with json/xml responses. Basically my users'' index action looks like this: def index @page = params[:page] || 1 @per_page = (params[:per_page] == "limited" ? 5 : User.per_page) @users = User.paginate(:all, :page => @page, :per_page => @per_page, :conditions => ["state = ?", "active"], :order => ''created_at DESC'') respond_to do |format| format.xml { render :xml => @users } format.json { render :json => @users } end end Now going to /users.json and/or /users.xml I see something like this in my log: Processing UsersController#index to json (for 127.0.0.1 at 2009-02-14 03:55:35) [GET] Parameters: {"format"=>"json", "action"=>"index", "controller"=>"users"} Completed in 23ms (View: 9, DB: 4) | 200 OK [http://localhost/ users.json] Sat Feb 14 03:43:08 +0100 2009: Read error: #<NoMethodError: private method `split'' called for 0:Fixnum> /Users/joerg/Development/dw/vendor/rails/actionpack/lib/ action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:66:in `process'' /Users/joerg/Development/dw/vendor/rails/actionpack/lib/ action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:65:in `each'' /Users/joerg/Development/dw/vendor/rails/actionpack/lib/ action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:65:in `process'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'' /Users/joerg/Development/dw/vendor/rails/actionpack/lib/ action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:32:in `run'' /Users/joerg/Development/dw/vendor/rails/railties/lib/commands/ server.rb:111 /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' ./script/server:3 And I get this back in my client app: HTTP/1.1 200 OK Connection: close ... and -no- data. I''ve tried this with mongrel & passenger... both time the same. Am I missing something here? Switching back to 2.2.. works fine, 2.3... it doesn''t. -J --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---