You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

020_add_role_position.rb 275B

12345678910
  1. class AddRolePosition < ActiveRecord::Migration
  2. def self.up
  3. add_column :roles, :position, :integer, :default => 1
  4. Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)}
  5. end
  6. def self.down
  7. remove_column :roles, :position
  8. end
  9. end