diff --git a/db/migrate/069_add_enviroment_id_to_role.rb b/db/migrate/069_add_enviroment_id_to_role.rb index 3a1ff60..380245e 100644 --- a/db/migrate/069_add_enviroment_id_to_role.rb +++ b/db/migrate/069_add_enviroment_id_to_role.rb @@ -6,7 +6,7 @@ class RoleWithEnvironment < ActiveRecord::Base end class RoleAssignment < ActiveRecord::Base belongs_to :accessor, :polymorphic => true - belongs_to :target, :polymorphic => true + belongs_to :resource, :polymorphic => true end class AddEnviromentIdToRole < ActiveRecord::Migration @@ -19,7 +19,7 @@ class AddEnviromentIdToRole < ActiveRecord::Migration re = RoleWithEnvironment.new(role.attributes) re.environment = env re.save - RoleAssignment.find_all_by_role_id(role.id).select{|ra| (ra.target.kind_of?(Profile) ? ra.target.environment_id : ra.target.id) == env.id }.each do |ra| + RoleAssignment.find_all_by_role_id(role.id).select{|ra| (ra.resource.kind_of?(Profile) ? ra.resource.environment_id : ra.resource.id) == env.id }.each do |ra| ra.role_id = re.id ra.save end -- libgit2 0.21.2