Vote #68724
完了'undefined method `reschedule_after' for nil:NilClass' on new issues
0%
説明
I'm trying to use the REST API to submit some issues, but I'm getting the following error:
NoMethodError in IssuesController#create undefined method `reschedule_after' for nil:NilClass
This problem doesn't occurs always, but I couldn't find a pattern up to now.
It does not happen on redmine 1.0.3.
journals
I did several tests now and no pattern yet. Submitting the same xml works once, then fails, then works again. The full stack is:
<pre>
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue_relation.rb:88:in `set_issue_to_dates'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue.rb:764:in `reschedule_following_issues'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `each'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue.rb:763:in `reschedule_following_issues'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in `run'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `each'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `run'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in `callback'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:251:in `create_or_update'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2538:in `save_without_validation'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1078:in `save_without_dirty'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:79:in `save_without_transactions'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/controllers/issues_controller.rb:129:in `create'
</pre>
It seems that some code creates a IssueRelation with 'issue_to' nil.
--------------------------------------------------------------------------------
I did a new 1.0.4 checkout and the problem doesn't seem to be present. It's very strange, because a diff in both working copies only show unrelated files..
Is there any change that a deleted plugin caused something like that? Is there any way to reset any plugin data?
--------------------------------------------------------------------------------
Mi thoughts on previuos post were wrong, the problem happens also with the new 1.0.4 checkout.
After several hours of debugging, I tried to see if there was something wrong with my data. so I ran the following query:
<pre>
select * FROM issue_relations
where issue_from_id not in
(select id from issues)
or issue_to_id not in
(select id from issues)
</pre>
Surprisingly, this query returned a lot of lines!! After delete those entries, the problem was gone.
I don't understand how could invalid entries on the table issue_relation could influence the creation of a new issue, but it does indeed. I created a new issue asking for FK contraints, #7032.
Please close it as 'not a bug'.
--------------------------------------------------------------------------------
r4467 will prevent this error to occur.
--------------------------------------------------------------------------------
Fix merged in 1.0-stable.
--------------------------------------------------------------------------------