Project

General

Profile

Actions

Defect #7085

closed

"create project" with empty trackers list gives "NoMethodError (undefined method `each' for nil:NilClass)"

Added by Alex Last over 13 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
2010-12-09
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

sending this xml to redmine REST API (last Trunk version of Redmine code):

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <name>project number 1291862021991</name>
  <identifier>projkey1291862021991</identifier>
  <trackers/>
</project>

Result:

server error 500

server log contains:

Processing ProjectsController#index (for 192.168.0.13 at 2010-12-08 18:33:31) [GET]
  Parameters: {"action"=>"index", "controller"=>"projects"}
Rendering template within layouts/base
Rendering projects/index
Completed in 57ms (View: 30, DB: 16) | 200 OK [http://academ/projects]

Processing ProjectsController#create to xml (for 192.168.0.13 at 2010-12-08 18:33:44) [POST]
  Parameters: {"format"=>"xml", "action"=>"create", "project"=>{"name"=>"project number 1291862021991", "trackers"=>nil, "identifier"=>"projkey1291862021991"}, "controller"=>"projects", "key"=>"01d7692c218a74d60d25d8eb5f62874a22ef8599"}

NoMethodError (undefined method `each' for nil:NilClass):
  app/models/project.rb:88:in `initialize'
  app/controllers/projects_controller.rb:75:in `new'
  app/controllers/projects_controller.rb:75:in `create'
  /usr/lib/ruby/1.8/mongrel/rails.rb:76:in `process'
  /usr/lib/ruby/1.8/mongrel/rails.rb:74:in `synchronize'
  /usr/lib/ruby/1.8/mongrel/rails.rb:74:in `process'
  /usr/lib/ruby/1.8/mongrel.rb:159:in `process_client'
  /usr/lib/ruby/1.8/mongrel.rb:158:in `each'
  /usr/lib/ruby/1.8/mongrel.rb:158:in `process_client'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `run'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `initialize'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `new'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `run'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `initialize'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `new'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `run'
  /usr/lib/ruby/1.8/mongrel/configurator.rb:282:in `run'
  /usr/lib/ruby/1.8/mongrel/configurator.rb:281:in `each'
  /usr/lib/ruby/1.8/mongrel/configurator.rb:281:in `run'
  /usr/lib/ruby/1.8/mongrel/command.rb:212:in `run'

Rendering /opt/redmine/public/500.html (500 Internal Server Error)

Actions #1

Updated by Go MAEDA over 7 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

No problem in the current trunk (r16138).

$ cat request.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <name>project number 1291862021991</name>
  <identifier>projkey1291862021991</identifier>
  <tracker_ids/>
</project>

$ curl -v --user admin:admin --header 'Content-type: application/xml' --data-binary '@request.xml' http://localhost:3000/projects.xml
<?xml version="1.0" encoding="UTF-8"?><project><id>17</id><name>project number 1291862021991</name><identifier>projkey1291862021991</identifier><description/><homepage></homepage><status>1</status><is_public>true</is_public><custom_fields type="array"><custom_field id="3" name="Development status"><value></value></custom_field><custom_field id="13" name="cf_user"><value/></custom_field></custom_fields><created_on>2017-01-07T05:25:11Z</created_on><updated_on>2017-01-07T05:25:11Z</updated_on></project>
Actions #2

Updated by Toshi MARUYAMA over 7 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF