Mercurial > hg > soundsoftware-site
comparison .svn/pristine/66/66ab27fbec26a34302ffce7f06e525b4e0ebdfde.svn-base @ 1464:261b3d9a4903 redmine-2.4
Update to Redmine 2.4 branch rev 12663
author | Chris Cannam |
---|---|
date | Tue, 14 Jan 2014 14:37:42 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1296:038ba2d95de8 | 1464:261b3d9a4903 |
---|---|
1 class AddCustomFieldsPosition < ActiveRecord::Migration | |
2 def self.up | |
3 add_column(:custom_fields, :position, :integer, :default => 1) | |
4 CustomField.all.group_by(&:type).each do |t, fields| | |
5 fields.each_with_index do |field, i| | |
6 # do not call model callbacks | |
7 CustomField.update_all "position = #{i+1}", {:id => field.id} | |
8 end | |
9 end | |
10 end | |
11 | |
12 def self.down | |
13 remove_column :custom_fields, :position | |
14 end | |
15 end |