Defect #7377
Updating an Issue with custom fields set fails in V.1.1.0
| Status: | New | Start date: | 2011-01-19 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | Custom fields | |||
| Target version: | - | |||
| Affected version: | 1.1.0 | Resolution: |
Description
The fix mentioned in related Ticket: #6403
is not working for me. (Redmine V.1.1.0)
When I enter into the console:
issue = Issue.find(1) issue.custom_field_values[1] = dummy_value issue.save!
I get this error:
NoMethodError: undefined method `save' for nil:NilClass from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:180:in `to_proc' from /usr/share/redmine/vendor/plugins/acts_as_customizable/lib/acts_as_customizable.rb:94:in `each' from /usr/share/redmine/vendor/plugins/acts_as_customizable/lib/acts_as_customizable.rb:94:in `save_custom_field_values' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run' from /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/callbacks.rb:251:in `create_or_update' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/base.rb:2555:in `save_without_validation!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/validations.rb:1088:in `save_without_dirty!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!' from /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!' from (irb):8>> /usr/share/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb
Related issues
History
#1 Updated by Siegfried Vogel over 2 years ago
I'm stuck. Is there some sample code showing how I am supposed to add a new Issue with some custom fields in a Redmine plugin?
Thanks a lot for your help!
#2 Updated by Stefan Langenmaier over 2 years ago
You need to save the custom fields with an extra command before you can save the issue.
issue.save_custom_field_values
And double check that you have set all custom values that are required!
#3 Updated by Toshi MARUYAMA about 2 years ago
- Category set to Custom fields