Module: OpenProject::ServicePacks::Patches::EnumerationPatch::InstanceMethods

Defined in:
lib/open_project/service_packs/patches/enumeration_patch.rb

Instance Method Summary collapse

Instance Method Details

#update_sp_ratesObject

Activities are always created and updated as a new Enumeration (see EnumerationsController#create, #update and line 117 - 123) so #TEA patching doesn’t work.



13
14
15
16
17
18
19
20
21
# File 'lib/open_project/service_packs/patches/enumeration_patch.rb', line 13

def update_sp_rates
  if type == "TimeEntryActivity" && shared?
      ServicePack.availables.each do |service_pack|
        # service_pack.mapping_rates << self # WRONG: this is NOT a plain Ruby collection!
             # trying to give a sensible default value
          service_pack.mapping_rates.create!(units_per_hour: 0, activity_id: self.id)
      end
    end
end