ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

0001-467-Fix-uninitialized-constant-Journal-Journaled-err.patch

Eric Davis, 2011-06-16 05:47 pm

Download (1.6 kB)

 
b/db/migrate/20100714111651_generalize_journals.rb
35 35

  
36 36
    Journal.all.group_by(&:journaled_id).each_pair do |id, journals|
37 37
      journals.sort_by(&:created_at).each_with_index do |j, idx|
38
        j.update_attribute(:type, "#{j.journalized_type}Journal")
39
        j.update_attribute(:version, idx + 1)
38
        # Recast the basic Journal into it's STI journalized class so callbacks work (#467)
39
        klass_name = "#{j.journalized_type}Journal"
40
        j = j.becomes(klass_name.constantize)
41
        j.type = klass_name
42
        j.version = idx + 1
40 43
        # FIXME: Find some way to choose the right activity here
41
        j.update_attribute(:activity_type, j.journalized_type.constantize.activity_provider_options.keys.first)
44
        j.activity_type = j.journalized_type.constantize.activity_provider_options.keys.first
45
        j.save(false)
42 46
      end
43 47
    end
44 48

  
45
-