Revision 13453
Added by Toshi MARUYAMA almost 11 years ago
sandbox/rails-4.1/db/migrate/078_add_custom_fields_position.rb | ||
---|---|---|
4 | 4 |
CustomField.all.group_by(&:type).each do |t, fields| |
5 | 5 |
fields.each_with_index do |field, i| |
6 | 6 |
# do not call model callbacks |
7 |
CustomField.update_all "position = #{i+1}", {:id => field.id}
|
|
7 |
CustomField.where({:id => field.id}).update_all("position = #{i+1}")
|
|
8 | 8 |
end |
9 | 9 |
end |
10 | 10 |
end |
Also available in: Unified diff
db migrate: replace deprecated Relation#update_all at 078_add_custom_fields_position.rb (#18132)