summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-04 17:58:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-04 17:58:14 +0000
commit7cdd88a6ce3632c801223b33e5ccc2b9fc13651e (patch)
treea270478d7d7626ac9970d69e32cac6c6807e6cf4 /db
parent22558f77094dce4d489dac410abd7b74e48cdcb0 (diff)
downloadredmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.tar.gz
redmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.zip
Merged Rails 2.1 compatibility branch.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1623 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/072_add_enumerations_position.rb2
-rw-r--r--db/migrate/078_add_custom_fields_position.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/db/migrate/072_add_enumerations_position.rb b/db/migrate/072_add_enumerations_position.rb
index e0beaf395..22558a6e9 100644
--- a/db/migrate/072_add_enumerations_position.rb
+++ b/db/migrate/072_add_enumerations_position.rb
@@ -1,7 +1,7 @@
class AddEnumerationsPosition < ActiveRecord::Migration
def self.up
add_column(:enumerations, :position, :integer, :default => 1) unless Enumeration.column_names.include?('position')
- Enumeration.find(:all).group_by(&:opt).each_value do |enums|
+ Enumeration.find(:all).group_by(&:opt).each do |opt, enums|
enums.each_with_index do |enum, i|
# do not call model callbacks
Enumeration.update_all "position = #{i+1}", {:id => enum.id}
diff --git a/db/migrate/078_add_custom_fields_position.rb b/db/migrate/078_add_custom_fields_position.rb
index 7ee8abb58..1c42ae732 100644
--- a/db/migrate/078_add_custom_fields_position.rb
+++ b/db/migrate/078_add_custom_fields_position.rb
@@ -1,7 +1,7 @@
class AddCustomFieldsPosition < ActiveRecord::Migration
def self.up
add_column(:custom_fields, :position, :integer, :default => 1)
- CustomField.find(:all).group_by(&:type).each_value do |fields|
+ CustomField.find(:all).group_by(&:type).each do |t, fields|
fields.each_with_index do |field, i|
# do not call model callbacks
CustomField.update_all "position = #{i+1}", {:id => field.id}