summaryrefslogtreecommitdiff
path: root/db/migrate/20130224081700_groups_to_user_groups_in_routes.rb
blob: 5e03cfabfe4f6fdfea9b068d26d4f659f213e834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class GroupsToUserGroupsInRoutes < ActiveRecord::Migration
  def up
    RouteElement.where(:var_in => 'val:auth_account.owner.groups').each do |route_element|
      route_element.update_attributes(:var_in => 'val:auth_account.owner.user_groups')
    end
    RouteElement.where(:var_in => 'val:account.owner.groups').each do |route_element|
      route_element.update_attributes(:var_in => 'val:account.owner.user_groups')
    end
  end

  def down
  	RouteElement.where(:var_in => 'val:auth_account.owner.user_groups').each do |route_element|
      route_element.update_attributes(:var_in => 'val:auth_account.owner.groups')
    end
    RouteElement.where(:var_in => 'val:account.owner.user_groups').each do |route_element|
      route_element.update_attributes(:var_in => 'val:account.owner.groups')
    end
  end
end