Bug #3358
closed
xmera Omnia - Collection #3596: Bug fixing of several modules
Clicking on a project query resets modules and tracker to default values
Added by liaham 2 months ago.
Updated 18 days ago.
Compatible Redmine Version:
6.0.z
Description
When a user clicks on a saved project query, modules and trackers are reset to default values. The reason is unknown so far.
- Status changed from New to In Progress
- Start date set to 04/28/2025
- % Done changed from 0 to 20
This Rails method does not work with RM Project class due to the modified Project#initialize
method which will set some attributes to default values.
def becomes(klass)
became = klass.allocate
became.send(:initialize) do |becoming|
@attributes.reverse_merge!(becoming.instance_variable_get(:@attributes))
becoming.instance_variable_set(:@attributes, @attributes)
becoming.instance_variable_set(:@mutations_from_database, @mutations_from_database ||= nil)
becoming.instance_variable_set(:@new_record, new_record?)
becoming.instance_variable_set(:@destroyed, destroyed?)
becoming.errors.copy!(errors)
end
became
end
The idea is to write a similar method where the Project instance will be added as method param in order to get its attributes. This should prevent the attributes to be created with the default values for enabled modules, tracker and the like.
- Due date set to 04/30/2025
- Status changed from In Progress to Closed
- Priority changed from Normal to High
- % Done changed from 20 to 100
Problem solved by using ActiveRecord::Base#init_with_attributes
.
- Target version changed from unreleased to 4.6.2
Also available in: Atom
PDF